This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to manipulate output parameter

Hi folks,

We are using Identity Manager 8.0.1. 

I have a process orchestration which involves process steps of ScriptComponent --> MailComponent - SendRichMail --> MailComponent - SendRichMail. I would like to get the output of the scriptcomponent and manipulate it (i.e. split the string) and pass one half to one mailcomponent and the other one to the other mailcomponent.

How we have configured so far are as follows:

The ParamOut for ScriptComponent is a fixed length string.

On the MailComponent process step, which one sits on top of the 2nd mailcomponent, we set a ParamName1 and ParamValue1 on both components to take in the return String of the ScriptComponent.

By setting Value = "&OUT(returnString)&" , we are able to get the full String, but we want to only some characters.

So, I tried something like Value ="&OUT(returnString)&".toString().SubString(0,4) but it will give me the literal string.

On the other hand, I've tried to return an array String in the ScriptComponent so that both MailComponents are able to access by "&OUT(returnString)&"[0] and "&OUT(returnString)&"[1] respectively, but the results turn out to be the same as the previous. 

Appreciate and seeking suggestions on how we should go about to do this. 

Thank you ! 

- Dhin 

  • Code in job parameters, generating condition and pre-script for generating are evaluated at the time the process instance is generated.The &OUT... is really just a placeholder for a string replacement. At generation time the value &OUT... hasn't yet been replaced so that's why you get the literal value. 

    To extract a value from an out parameter you could do either of the following, in order of preference, highest first:

    1 - Call the script from the process' pre-script for generating and store the value in the Values object for later use. This way you avoid using an out-parameter, but I'm guessing that there's a reason why can't do this and that's why you're using a script component + out parameter.

    2 - Pass the out parameter into another script to extract your value. Convoluted, but it will work.

    3 - Split the process into two. One for the script, the other for sending the mails. The first process generates the out parameter, and fires the event for the second process, passing in the out parameter as a process parameter. The second process can then manipulate the value passed in via the process parameter using option 1. 

  • Yup, #1 was not possible because the value is only calculated in the ScriptComponent. 

    The tricky part was to pass parameters into standalone MailComponent process, which is a separate process from the ScriptComponent. As the MailComponent provides custom parameters to pass in from ParamName1, ParamName2 and its respective values (i.e. ParamValue1 etc.), I had to write inside the ScriptComponent, the name of the parametervalue (2nd parameter in IUnitOfWork.Generate method). 

    The code is as such --> 

    htParameters.Add("ParamValue1",<value>)

    uow.Generate(dbPWO,"myEvent",htParameters) . 

     

    In my MailComponent, I have the following configuration:

    ParamName1 = "MyParam".

    I did not tick ParamValue1 because I do not want to pre-set any values and I want the ScriptComponent to pass the ParamValue1's value. 

    I'm happy it works, seeing two MailComponents being spawned with different ParamValue1's value. #3 was the solution for me.

    Thank you Craig for your suggestion. 

     

    Is there some way that I can declare a better naming parameter convention in MailComponent, rather than ParamValue1?

    The problem is that the custom parameters in MailComponent comes with 2 paramaters, the name and Value. (i.e. ParamName2 and ParamValue2 etc.)

    If I try to rename ParamName1 to MyParam, I am still going to have to pass its value via ParamValue1. Passing the value directly to MyParam will cause an error on the MailComponent side whereby the error reads something like "MyParam is not declared."

  • *not 2nd parameter in IUnitOfWork.Generate method

    but the first parameter in the dictionary htParameters, I would prefer if I can put a better naming convention. 

  • If you take a look at the documentation here https://support.oneidentity.com/technical-documents/identity-manager/8.0.1/configuration-guide/94 you will find that in your use case, you do not need to set the process step parameters ParamName1(-n) and ParamValue1(-n) as you can control the parameter name explicitly in your parameter collection while generating the process.

    So in your code, you are setting the parameter MyParam with htParameter.Add("MyParam",<myvalue>)

    In the rich mail template, you can reference the parameter than with $PC(MyParam)$

    That should do the trick.