Casting parameters to text in body

This is probably super simple and my brain is again causing me problems, but is there a built in way to take a value from a parameter that is for example a number type but in the output turn it into text.

This application has a method to update fields that takes a field key (number) and only a text value - for everything including booleans, dates, and numbers. “true”, “3.14” etc.

I would just accept only text values for the parameters but that makes validation more difficult.

The API expects the following body.

{
  "UpdateFields": [
    {
      "ProjectFieldId": 1,
      "Value": "text"
    },
    {
      "ProjectFieldId": 2,
      "Value": "text"
    },
    {
      "ProjectFieldId": 3,
      "Value": "text"
    },
    {
      "ProjectFieldId": 4,
      "Value": "text"
    }
  ]
}

Here are the mappable parameters:

[
    {
        "name": "projectId",
        "type": "uuid",
        "label": "Project ID",
        "required": true
    },
    {
        "name": "updateFields",
        "spec": [
            {
                "name": "ProjectFieldId",
                "type": "select",
                "label": "Field",
                "options": [
                    {
                        "label": "Project Name",
                        "value": 1,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Project Name",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "Status",
                        "value": 2,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Status",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "Start Date",
                        "value": 3,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Date",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "End Date",
                        "value": 4,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Date",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "Estimated Close Date",
                        "value": 5,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Date",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "Close Date",
                        "value": 6,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Date",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "Budget",
                        "value": 7,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Budget",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "Scope of Work",
                        "value": 8,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Scope Text",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "AssignedTo",
                        "value": 9,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Name",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "SalesRep",
                        "value": 10,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Name",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "ProjectManager",
                        "value": 11,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Name",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "Designer",
                        "value": 12,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Name",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField1",
                        "value": 101,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField2",
                        "value": 104,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField3",
                        "value": 103,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField4",
                        "value": 104,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField5",
                        "value": 105,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField6",
                        "value": 106,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField7",
                        "value": 107,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField8",
                        "value": 108,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField9",
                        "value": 109,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField10",
                        "value": 110,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField11",
                        "value": 111,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField12",
                        "value": 112,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField13",
                        "value": 113,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField14",
                        "value": 114,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField15",
                        "value": 115,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField16",
                        "value": 116,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField17",
                        "value": 117,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField18",
                        "value": 118,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField19",
                        "value": 119,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField20",
                        "value": 120,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField21",
                        "value": 121,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField22",
                        "value": 122,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField23",
                        "value": 123,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField24",
                        "value": 124,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField25",
                        "value": 125,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField26",
                        "value": 126,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField27",
                        "value": 127,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField28",
                        "value": 128,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField29",
                        "value": 129,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField30",
                        "value": 130,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField31",
                        "value": 131,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField32",
                        "value": 132,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField33",
                        "value": 133,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField34",
                        "value": 134,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField35",
                        "value": 135,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField36",
                        "value": 136,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField37",
                        "value": 137,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField38",
                        "value": 138,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField39",
                        "value": 139,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField40",
                        "value": 140,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField41",
                        "value": 141,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField42",
                        "value": 142,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField43",
                        "value": 143,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField44",
                        "value": 144,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField45",
                        "value": 145,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField46",
                        "value": 146,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField47",
                        "value": 147,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField48",
                        "value": 148,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField49",
                        "value": 149,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField50",
                        "value": 150,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField51",
                        "value": 151,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField52",
                        "value": 152,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField53",
                        "value": 153,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    },
                    {
                        "label": "CustomField54",
                        "value": 154,
                        "nested": [
                            {
                                "type": "text",
                                "label": "Value",
                                "name": "Value",
                                "required": false
                            }
                        ]
                    }
                ]
            }
        ],
        "type": "array",
        "label": "Update Fields",
        "required": false
    }
]

However field 4 is a date. Where I am hung up is on converting all the value fields toString within the custom app.

@Cody_Frisch I believe you would be able to use the toString() function. This is a built-in IML function you can always use. See:

Cheers!
~Bjorn

not much help, since the only example is within a custom IML function, not in the communication of a module. I dont have the ability to do custom IML functions since those are for special people it seems.

At this point I’m just leaving the parameters as text, at least it works.

@Cody_Frisch I think you can reach further than only what is given to you.
There is more documentation there, which I believe you should be able to find on your own. For example:

Good you got it working ! Hope this helps for you.

2 Likes