How to get the data written by user in wizard in profile load script of an activity running in Process Automation.
The Default instance has the following data:
In the profile load I would like to get the "Stop" value as event type as this is what I selected in the wizard.
Hi,
As the input is coming from the Booking wizard rather then the passed volatile profile instances, there is another way to read the actual values from the booking wizard:
1. Your automation script should receive as input 3 values: "Info", "ProfileInstance" and "ProcessInfo".
2. Deserialize the input "Info" to have a SrmResourceConfigurationInfo object and the input "ProfileInstance" to have a Dictionary containing all the profile instances.
3. Create a new instance of ProfileParameterEntryHelper(Engine engine) and collect all the parameters with .GetNodeProfileParameterEntries().
I've included a small code snipped that should let you receive the list of parameters with the values you've specified in the booking wizard.
ScriptParam paramInfo = engine.GetScriptParam("Info");
ScriptParam paramProfileInstance = engine.GetScriptParam("ProfileInstance");
ScriptParam paramProcessInfo = engine.GetScriptParam("ProcessInfo");var srmInfo = JsonConvert.DeserializeObject<SrmResourceConfigurationInfo>(paramInfo.Value);
if (srmInfo == null)
{
throw new ScriptInputValueNullException("SRM Info is null or is not in the correct format (Serialize SrmResourceConfigurationInfo to JSON).");
}var srmNodeProfileConfiguration = JsonConvert.DeserializeObject<Dictionary<string, Guid>>(paramProfileInstance.Value);
if (srmNodeProfileConfiguration == null || !srmNodeProfileConfiguration.Any())
{
throw new ScriptInputValueNullException("ProfileInstance is null or is not in the correct format (Serialize Dictionary<string, string> to JSON).");
}var helper = new ProfileParameterEntryHelper(engine);
List<ProfileParameterEntry> parameters = helper.GetNodeProfileParameterEntries(srmInfo, new NodeProfileConfiguration(srmNodeProfileConfiguration), true).ToList();
Hi Mieke,
Process Automation behaves slightly different from “regular” SRM and I do believe you need to always use the “By Reference” option.
Which means you must have a different Profile Instance for your “Stop” value.
After a quick test, Process automation indeed takes the reference value. The solution then would be to create a new Profile Instance with the new value like João mentioned.
My code snippet can then be ignored as it not applicable for process automation.
Hello Robin,
I’ve tried this, but it gets the default value that is filled in the profile instance definition. In this example = “Start”
I’ve also tried this witht he same result:
helper.GetNodeSrmParametersConfiguration(configurationInfo, nodeProfileConfiguration).ToList();