Hello Everyone,
I am using a Console App to replace Business Process Flow from old Lead Records which are using the old Business Process Flow. I have written a Console App which works perfectly fine to update the records with new BPF. However, I run into an issue when I open any old existing lead record with the old BPF, then try running my Console App, and it still doesn't update the record with new BPF, only because i opened the record once. It successfully updates the record with new BPF if I don't open the record.
I am not sure what am i missing and where the error could be.
Below is the code i am using in my console app:
QueryExpression qe = new QueryExpression { EntityName = "lead", ColumnSet = new ColumnSet(true) };
qe.Criteria.AddCondition("firstname", ConditionOperator.Equal, "Hulk");
qe.Criteria.AddCondition("lastname", ConditionOperator.Equal, "Hogan");
//qe.Criteria.AddCondition("statecode", ConditionOperator.Equal,0);
//QueryExpression qe = new QueryExpression("lead");
EntityCollection ec = serviceClient.RetrieveMultiple(qe);
Console.WriteLine("Retrieved {0} records", ec.Entities.Count);
try
{
ec.Entities.ToList().ForEach(x =>
{
SetProcessRequest request = new SetProcessRequest();
request.Target = new EntityReference("lead", x.Id);
request.NewProcess = new EntityReference("workflow", new Guid("********-****-****-****-************"));
serviceClient.Execute(request);
});
}
catch (Exception e)
{
Console.WriteLine(e);
}
Appreciate your help with this.
Thank you,
Do you mind sharing your solution?
I am looking into the same issue.
Arun,
Appreciate your help with this. But I have found a way. I have developed a Console App where I can update the old Lead Records with the new one. I ended up adding a logic where the Console App will also Delete the lead record from old BPF entity and that resolves my issue. So in my scenario i had 2 BPFs (one was old BPF and other one is new), all the old leads were added under old bpf and now i created a console app where all the old leads will be updated with new bpf and the console app will also delete the entry of lead record from old BPF entry. If some records falls through the cracks then those records will be handled by OnLoad JS Code which i had added already.
Thanks again! :)
Take a look at the discussion in the link I shared earlier. Dmitry situation is almost identical to you & his solution should work for you.
Basically instead of console app, you can do the same in form load JavaScript so that for all the users when they open the record it will switch.
You can do Adv find & verify the active entries of 2 different BPFs for that Lead record. This is intended for 2 different departments working in the same record using concurrent BPFs. CRM System misunderstood it.
You have to abandon/deactivate/delete the unwanted old BPF instance record.
Hi Durgesh ,
I don't think its possible but you can give a try with below understanding -
When you are creating any Entity Record using BPF its basically create record with entity lookup value in the BPF Entity (You will find the BPF entity in Advanced find with same name as BPF. Under BPF entity in the advanced find you will get the lookup field of the the entity which BPF attached). If you remove all record from the 1st BPF entity all the entity record will detach from the 1st BPF. Before delete You need to do some data analysis which fields you need retrieve to create those data in second BPF entity copying from 1st BPF entity.
Hi All,
I have 2 BPFs and i need to update my records and replace it with new BPF. I have created a console app to assign new BPF to my lead records. However, how can i remove the associated records from my old BPF entity using Console App?
Whenever i execute the my console app the records gets associated to new BPF entity and it creates a new record in new BPF entity.
I want to delete the BPF record from my old BPF entity.
Please let me know for any questions.
Thank you,
Durgesh
Also, just an add on to this, I am trying to replace the BPF of multiple lead records from old to new one. As you are aware 2 BPF means 2 different entities. Whenever my console app executes it will associate the lead record i am firing for to the new BPF and it will create the record in new BPF entity for that lead. Now my next action what i want to add in my console app is to remove the same lead record entry from the old BPF entity.
Please let me know if it's sounds confusing. I'll be happy to clear any doubt.
Thank you,
Durgesh
Arun,
Hope you're doing well. I am running my Console App using different login information and viewing the CRM record using my own credentials. But even when i tried to execute the console app using the credentials i use and tried to view the CRM record using the same credentials, it still doesn't update.
Please let me know for any questions.
Thank you,
Durgesh
It looks like the console app is running in different user login than you are using to verify in UI. Concurrent BPF introduced this different intended behavior. Probably you have to iterate all the users to update who are having this BPF entry made for them when already opened the entity record form.
There was a really long discussion happened in the past about this.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156