Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Assigning GUID and a static url to two fields through custom workflow error

$
0
0

 I have created a plugin in which I want to embed a static url with the record guid. Initially, I want to check if the record guid is getting pulled. So I created two fields - "urllink" and "guidrecord" where I will store  the static url and record guid  My code is below. The fields are not getting populated. Any idea why?

There are no errors in the code

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using Microsoft.Xrm.Sdk.Workflow;

using Microsoft.Xrm.Sdk;

using Microsoft.Xrm.Sdk.Query;

using System.Activities;

using Microsoft.Xrm.Sdk.Client;

using Microsoft.Crm.Sdk.Messages;

namespace wfpluginstest

{

   public class guidtofield : CodeActivity

   {

       protected override void Execute(CodeActivityContext executionContext)

       {

           //Create the context

           IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();

           IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();

           IOrganizationService _service = serviceFactory.CreateOrganizationService(context.UserId);

           if (context.PrimaryEntityName !== null)

           {

               Entity localdiscountfbapproval = new Entity("accountapproval");

               var guidofrecord= context.PrimaryEntityId;

               string staticurl = "http://test-rec:96/?id=&quot";

               localdiscountfbapproval["guidrecord"] = recordguid;

               localdiscountfbapproval["urllink"] = staticurl;

           }

       }

   }

}


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images