locked
get list of account RRS feed

  • Question

  • hi all,
    i have the follwoing scenario :

    i have black list and i need to add accounts to this black list in step of workflow , in this step i need to set  the accounts which i want
    this step i make it in vs .net as activity
    in code of that activity i will add those selected account programaticlly to my entity (black list)
    how can i do that ?




    foreach(object HeartBeat in me.heart.Beats) messageBox.show("I miss u !!")
    Thursday, April 30, 2009 12:24 PM

Answers

  • Hi, Dany.

    Look this article. List object is not target for regardingobjectid. Look this article .
    Истина открывается подготовленному уму. Мой блог - http://a33ik.blogspot.com
    Sunday, May 3, 2009 5:18 PM
    Moderator

All replies

  • I see only one variant how to do this(passing couple of accounts to workflow) - you create Marketing list with this accounts in it and pass as parameter of workflow this list. In code of workflow using WebServices you can read this list of accounts and execute actions workflow has to do with those accounts.

    Any other ideas? Interesting task.

    Истина открывается подготовленному уму. Мой блог - http://a33ik.blogspot.com
    Thursday, April 30, 2009 12:44 PM
    Moderator
  • how can i pass those selected accounts to my code ?
    foreach(object HeartBeat in me.heart.Beats) messageBox.show("I miss u !!")
    Thursday, April 30, 2009 12:59 PM
  • Using MS CRM (mannually) you can create Marketing list which includes those accounts and pass retrieved Marketing List as a parameter to your workflow.

    Истина открывается подготовленному уму. Мой блог - http://a33ik.blogspot.com
    Thursday, April 30, 2009 1:07 PM
    Moderator
  • Dear a33ik,
    i'm new in crm
    how can i pass retriverd markiting list as a parameter to my workflow then my code.
    foreach(object HeartBeat in me.heart.Beats) messageBox.show("I miss u !!")
    Thursday, April 30, 2009 1:12 PM
  • Hi, Dany.

    Use following code for custom workflow to pass marketing list as a parameter to custom workflow:

    using System;
    using System.IO;
    using System.Net;
    using System.ComponentModel;
    using System.ComponentModel.Design;
    using System.Collections;
    using System.Workflow.ComponentModel.Compiler;
    using System.Workflow.ComponentModel.Serialization;
    using System.Workflow.ComponentModel;
    using System.Workflow.ComponentModel.Design;
    using System.Workflow.Runtime;
    using System.Workflow.Activities;
    using System.Workflow.Activities.Rules;
    using Microsoft.Crm.Sdk;
    using Microsoft.Crm.SdkTypeProxy;
    using Microsoft.Crm.Workflow;
    using Microsoft.Crm.Workflow.Activities;
    
    namespace CustomWorkflowActivity
    {
    	[CrmWorkflowActivity("Marketing list processor", "Custom")]
    	public class DateChecker : SequenceActivity
    	{
    		protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
    		{
    /*execute required operations with marketing list*/
    			return ActivityExecutionStatus.Closed;
    		}
    
    		public static DependencyProperty mlistProperty = DependencyProperty.Register("mlist", typeof(list), typeof(DateChecker));
    
    		[CrmInput("The estimated close date")]
    		[CrmReferenceTarget("list")]
    		public Lookup mlist
    		{
    			get
    			{
    				return (Lookup)base.GetValue(mlistProperty);
    			}
    			set
    			{
    				base.SetValue(mlistProperty, value);
    			}
    		}
    	}
    }
    

    Истина открывается подготовленному уму. Мой блог - http://a33ik.blogspot.com
    Thursday, April 30, 2009 1:46 PM
    Moderator
  • thanks a33ik , i will work on
    foreach(object HeartBeat in me.heart.Beats) messageBox.show("I miss u !!")
    Thursday, April 30, 2009 1:56 PM
  • hi a33ik,

    i did what you told me exactly,
    what i did in c# code is  folowing :

    protected override ActivityExecutionStatus Execute(
        ActivityExecutionContext executionContext)
            {
                IContextService contextService = (IContextService)executionContext.GetService(typeof(IContextService));
                IWorkflowContext context = contextService.Context;
    
                ICrmService crmService = context.CreateCrmService();
    
                phonecall pc = new phonecall();
                pc.regardingobjectid = mlist;
                crmService.Create(pc);
    
    }

    i published my workflow succesfully after passing the list parameter,

    but when workflow ran ,i noticed this error : " the parent is not valid so my phonecall did not created.
    any idea ??


    foreach(object HeartBeat in me.heart.Beats) messageBox.show("I miss u !!")
    Saturday, May 2, 2009 7:40 AM
  • Hi, Dany.

    Look this article. List object is not target for regardingobjectid. Look this article .
    Истина открывается подготовленному уму. Мой блог - http://a33ik.blogspot.com
    Sunday, May 3, 2009 5:18 PM
    Moderator