Change DCM of record automaticly



Hi community,

 

I have a business scenario where there is:

1) diferent DCM dependent on opportunity type, simple or complex

2) business case that if opportunity amount is above 10.000€ DCM should be changed from simple to complex

3) this should happen dinamically, meaning, if an opportunity is started as simple and later on the amount is above 10.000€ DCM should automaticly change from simplet to complex

 

I've managed to achieve most of the requirements via a business process that has a trigger event when amount is greater then 10.000€ to change opportunity type, with the exception of automaticly changing the DCM of the record.

What happens when I change the type of opportunity is this message:

" Creatio has found a case that better fits the launch conditions. Launch... "

Is there any way to change the DCM of the record without useer intervention?

 

Thanks,

Luis

Like 1

Like

5 comments

Hi!

 

I advice you to check code behind that " Creatio has found a case that better fits the launch conditions. Launch... " action and repeat it in your WF.

Hello Luis,

 

Hope my message finds you well.

 

If I understood your business task correctly, to do this you can analyze the button ActualDcmSchemaInformationButton in schema SectionActionsDashboard in package ActionsDashboard and the method that is triggered by clicking the button (onActualDcmSchemaInformationButtonLinkClick in schema DcmSectionActionsDashboardMixin). After that, you can implement similar logic to trigger on the onChange event of the column that determines which case to use.

 

Best regards,

Roman

Has anyone implemented that logic and can share it with others?

[EDIT]  Fixed issue with the sql query

 

This post is a bit old, but I found that the below worked well for me.  This will clear the process, which has to be done first.  Then you can use an update data element in your process to clear the current values in the fields linked to your flow and your step.  then add a timer to wait a few seconds and then Set the new values for flow and step.  Process cancelation is done asynchronously and must be canceled before you set your new DCM flow values

 

This is not elegant, but it works.  I dropped this into a user task, so I don't have to publish every time I want to use it (which is a lot)

 

var sql = $@"select pd.""Id"" from ""SysProcessData"" pd
	     join ""SysProcessElementData"" ped on pd.""Id"" = ped.""SysProcessId""
	     join public.""SysEntityCommonPrcEl"" el on el.""ProcessElementId"" = ped.""Id""
	     where ""RecordId""='{EntitySchemaId}'";
 
var query = new CustomQuery(UserConnection, sql);
var procId = query.ExecuteScalar<Guid>();
 
if(procId != Guid.Empty)
{
	var proc = context.UserConnection.ProcessEngine.FindProcessByUId(procId.ToString(), true);
	proc.CancelExecution();				
}
else
{
	//Error handling here
}

 

Best,

 

Jeremy

Hey Jeremy, 

It's been a while since you posted this, but I finally had a need to use this today. Worked great so huge thanks! Only changes I made were to add to the SQL a check to make sure it's a DCM process (and not some other process attached to the record). 

Something like this (with a join to SysSchema to get the process ManagerName): 

select pd."Id" from "SysProcessData" pd
join "SysProcessElementData" ped on pd."Id" = ped."SysProcessId"
join "SysEntityCommonPrcEl" el on el."ProcessElementId" = ped."Id"
join "SysSchema" sch on pd."SysSchemaId" = sch."Id"
where sch."ManagerName" = 'DcmSchemaManager'

ManagerName could be either "DcmSchemaManager" or "ProcessSchemaManager", this way, I'm only looking for the DCM processes. Also, I dug around to see if I could find a way to know that the process was canceled, like an event or anything, but no luck. That would be great to have to know it's canceled and you're clear to attach to the new/default DCM.

Anyway, thanks again for sharing this, a huge help!

Ryan

Show all comments