Get property value of element in Business Process from Script Task
Hello everyone!
I hope you can help me!
I want get the value of a property of a element of my Business Process.In this case, I read all of a employee and from my script task, I want to ask about the value of one of fields, "UsrClaveAltaTemprana". The compilation of the script task is correct but when I do the test from the employee's page and I will see ths process log it pulls the following error.
System.NullReferenceException: Object reference not set to an instance of an object.
at Terrasoft.Common.ReflectionUtilities.GetPropertyValueByPath(Object source, String propertyPath)
at Terrasoft.Core.Process.ProcessModel.Get[T](String propertyPath)
at Terrasoft.Core.Process.UsrProcess3MethodsWrapper.ScriptTask1Execute(ProcessExecutingContext context)
at Terrasoft.Core.Process.ProcessFlowElement.Execute(ProcessExecutingContext context)
I attached image
I appreciated your help!
King Regards,
Ezequiel Gómez
Like
Dear Ezequirel,
The reason for an error is that you are trying to obtain value of an Id. Let me explain.
"UsrClaveAltaTemprana" is a lookup field. Basically, it is a link to another object, so in database it is stored as an Id, but not the value.
If you intend to receive a value, you need to insert a "Read Data" element before a script task. Read the value from the object of "UsrClaveAltaTemprana" lookup, where Id equals the Id retrieved from the record.
Set received value to new parameter. Then use this parameter in script task.
Hope this helps.
Regards,
Anastasia