Please advise what could be the problem. There is a business process where the start signal (trigger) is set to launch when the text field "CHErrorNotification" in Opportunity is changed. If I change the field manually, the process starts, BUT if I change it via code, nothing happens—the process doesn't start. As you can see in the examples, I'm changing it not through a query; the process should start.
I tried filling the field both during the save and after; in both cases, the field was populated, but the process trigger did not work. OnSaving
Previously, and even now in other systems that I configured earlier, the process starts when such code changes occur. Regarding point 1, can you provide an example?
There are cases when a record is inserted directly from db and the bp doesn't trigger on object signal(Record Added/Modified), how do I proceed in these cases?
A direct database insert/update won't trigger a signal needed for a process to start. Only option I can think of is to flag the record in some way and have a process running on a timer looking for the flagged records.
if you have control over the insert/update process, you could set up a stored procedure in the DB and call it after the insert/update operation. The stored procedure could call the ProcessEngineService.svc via web request.
Can you provide more details on your custom code since I've created a simple method in the Account object that modifies a contact in the process inside the Account object (using onInserted method):
var contactEntity = UserConnection.EntitySchemaManager.GetInstanceByName("Contact");
var contactRecord = contactEntity.CreateEntity(UserConnection);
contactRecord.FetchFromDB("Id", new Guid("9c4111d2-cbf1-49f2-8c2b-00c6a82547c0"));
contactRecord.SetColumnValue("Name", "From the code");
contactRecord.Save();
and it triggers the business process with the start signal that is executed when the Contact name is modified. Maybe your logic is not modifying the record in the manner that should trigger the business process.
UsrContactSaved - the process on Contact schema that triggers when Contact record is saved ContactUtilities.ChangeContactStatus - the method that should change Status on schema Contact (this method is scheduled by job)
UsrOnContactStatusChanged - the process that should be triggered when the Status field in Contact schema was changed (but it doesn`t trigger)
So, when UsrContactSaved process triggered, there is a code in it that schedule a job that must call ContactUtilities.ChangeContactStatus in 10 minutes. After 10 minutes triggers ContactUtilities.ChangeContactStatus method and it changes Status via method in C# code.
In conclusion, status changed but UsrOnContactStatusChanged didn`t work. Expected result: UsrOnContactStatusChanged has to be triggered after work of UsrChangeContactStatusProcess process.