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 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.
I might be wrong, but I think Process Automation uses the references of the profile instance and not the value (if it is not a volatile process profile instance).
I think we have access to the following in the profile load script:
- Volatile Process Profile Instances
- Process Profile Instance Guid
- Input Itf Profile Instance
- Node Profile Instance
Hi Mieke,
To get the data written by user in wizard in profile load script or any other custom script it is recommended that you would:
- Create an SrmBookingConfiguration instance;
- Use a SrmBookingConfiguration.GetResource(string functioName) call to collect the SrmResourceConfiguration instance being the function name the Label configured in the node of your Service Definition.
- Use SrmResourceConfiguration.GetParameter call to collect the current value that is configured on that parameter of the respective node contained in the reservation.
In the profile Load Script you will be receiving as input the profile that is configured in the node.
In this case you have the Profile "SLC PLM Apply Options Default Instance", this Profile Instance will contain SLC PLM Event Type with Value Start whereas your reservation resource is configured with STOP given that on the wizard you have the By Reference box unticked.
By the moment your Profile Load Script kicks in your reservation has STOP configured. If you want to change its value use SrmResourceConfiguration.SetParameter
Note: If you have the "By Reference" box unticked the wizard saves your reservation with the param values you have configured. In the case you'd have a profile Instance selected and "By Reference" unticked that profile will also be stored in the reservation but take into account that the parameters that are stored in the reservation reflect what you explicitly configured not what the selected profile instance has.
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();