Set process parameter in script task

Hi,

how would I go about setting the process parameters in the screenshot, for instance the code for CellPhoneNumber is CellPhoneNumber. I have tried 

Set>("CellPhoneNumber", CellPhoneNumbers);

and

Set>("Collection.CellPhoneNumber", CellPhoneNumbers);

but for both I get the error that the process parameter does not exist

Thanks,

Like 0

Like

5 comments

Hi Tyler,

If the process parameter is a string/text param, all you need to do is:

Set("ParamName", "The param value");

(I don't see a screenshot in your post so not sure if it's something other than a simple text param)

Ryan

Ryan Farley,

Thank you for the response, I have now uploaded the screenshot

If it's a collection that does change things slightly with how you use it. The type of collection would matter (if a collection of records or collection of values etc). 

To add a record into the collection it would look something like this, assuming the param is a collection of records - based on your screenshot and assuming you're adding a new item to the collection:

// create collection/list
var list = new CompositeObjectList<CompositeObject>();
 
// create item and add to collection/list
var item = new CompositeObject();
item["CellPhoneNumber"] = "800-555-1212";
item["SomeOtherParamInCollection"] = "Some value, etc";
list.Add(item);
 
// now set in param
Set <CompositeObjectList<CompositeObject>>("MyCollectionParamName", list);

See more here https://customerfx.com/article/working-with-collection-parameters-in-a-…

Ryan

How to set it if my process parameter is a lookup value refering to contacts. I tried this Set<Guid>("SelectedAdjuster", Guid.parse("Lookup id"))

 

Youssef Seyam,

 

According to the business process trace where the lookup value was set manually

 

"Process parameters": [
        {
            "Parameter": "Test collection",
            "Value": {
                "Before execution": [
                    {
                        "Facility Id": "00000000-0000-0000-0000-000000000000",
                        "Contact": "c4ed336c-3e9b-40fe-8b82-5632476472b4"
                    }
                ],
                "After execution": [
                    {
                        "Facility Id": "00000000-0000-0000-0000-000000000000",
                        "Contact": "c4ed336c-3e9b-40fe-8b82-5632476472b4"
                    }
                ]
            }
        }
    ]

 

where Contact was my lookup nested parameter in the collection, then we should use:

 

...
var item = new CompositeObject();
item["UsrContactLookup"] = "c4ed336c-3e9b-40fe-8b82-5632476472b4";
...
Show all comments