had put that in...
If you use this custom field to populate the url in the Create workflow...
not set. It is set after the entity has been saved and an id assigned to it.
id was populated. And with the code snippet provided above this will happen
immideately after the revord is saved and the form loads again...
So the change would have to made at the workflow level... put a wait
condition for entity condition and choose new_url contains data.. or is not
null... so ti will wait till the url field has been populated and this will
happen immideately upon reload... after the save.
Post by unknownHi;
I recently read this thread and see the problems with automatically adding the entity id when creating a case, opporunity, contact etc.
Here is code for a workflow plugin for getting the guid of an incident. It can easily be modified to use other entities. Once completed simply create a workflow and reference this custom workflow plugin from it. I wish I could say it was all my own work but I just changed the code a bit from Aamir Bashir?s CRM blog
-much thanks to him for doing most of the work.
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
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;
using Microsoft.Crm.Sdk.Query;
namespace EntityURL
{
[CrmWorkflowActivity("Add ID to Case URL field")]
public partial class Activity1 : SequenceActivity
{
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
IContextService contextService = (IContextService)executionContext.GetService(typeof(IContextService));
IWorkflowContext context = contextService.Context;
ICrmService crmService = context.CreateCrmService();
WhoAmIRequest systemUserRequest = new WhoAmIRequest();
WhoAmIResponse systemUser = (WhoAmIResponse)crmService.Execute(systemUserRequest);
ColumnSet cols = new ColumnSet();
//Getting the ID of entity which unqiue itself
Guid guidID = new Guid(this.objectID.Value.ToString());
// i am using ?{? before GUID and "}" after.This field will hold the GUID of account
String Number = "{" + guidID + "}";
TargetRetrieveIncident target = new TargetRetrieveIncident();
target.EntityId = guidID;
RetrieveRequest getIncident = new RetrieveRequest();
getIncident.ReturnDynamicEntities = true;
getIncident.Target = target;
getIncident.ColumnSet = new AllColumns();
RetrieveResponse retrieved = (RetrieveResponse)crmService.Execute(getIncident);
DynamicEntity regardingIncident = (DynamicEntity)retrieved.BusinessEntity;
//I am using custom field to hold the value of ?GUID? .
if (regardingIncident.Properties.Contains("ba_entityurl"))
{
regardingIncident.Properties["ba_entityurl"] = Number;
}
else
{
regardingIncident.Properties.Add(new StringProperty("ba_entityurl", Number));
}
crmService.Update(regardingIncident);
return ActivityExecutionStatus.Closed;
}
public static DependencyProperty objectIDProperty = DependencyProperty.Register("objectID", typeof(Lookup), typeof(Activity1));
[CrmInput("objectID")]
[CrmReferenceTarget("incident")]
public Lookup objectID
{
get
{
return (Lookup)base.GetValue(objectIDProperty);
}
set
{
base.SetValue(objectIDProperty, value);
}
}
}
}
Submitted via EggHeadCafe
Twitter Search API with jQuery and JSONP
http://www.eggheadcafe.com/tutorials/aspnet/94d7bda5-c477-4ff9-b71d-e24e5fc70c24/twitter-search-api-with-jquery-and-jsonp.aspx