executestoredprocedure function passing apostrophe in Inputs parameter

Please let me know how do I pass apostrophe in Inputs parameter  for executestoredprocedure function

ocal!sp: fn!executestoredprocedure(
dataSourceName: "jdbc/DRO",
procedureName: "procCSS_Search",
inputs: {
{
name: "ssn",
value: ri!ssn
},
{
name: "lastname",
value: ri!lastName
},
{
name: "firstname",
value: ri!firstName
},
{
name: "caseid",
value: ri!caseId
},

{
name: "primaryCauseTF",
value: ri!primaryCauseTF
},
{
name: "causenum",
value: ri!causeNum
},
{
name: "oagnumber",
value: ri!oagNumber
},
{
name: "personid",
value: ri!personId
},
{
name: "phone",
value: ri!phone
},
{
name: "casestatus",
value: ri!caseStatusCode
},
},
timeout: 300
),

  Discussion posts and replies are publicly visible

Parents Reply
  • Yes this appears to be due to the procedure likely building a query and not doubling single quotes such as:

    Other than updating the procedure, you could try duplicating the single quotes in your call to the procedure, such as with replace().  Note I would recommend building this logic in a new shared/environmental rule where it can be adjusted in one location if needed, such as adding a check for a double apostrophe, etc:

    a!localVariables(
      local!lastName: "joss'e",
      local!index: search("'",local!lastName),
      
      if(
        local!index>0, /* apostrophe found, double it */
        replace(
          local!lastName,
          search("'",local!lastName),
          1,
          "''"
        ),
        local!lastName
      )
    )

    Additionally, if this procedure is not performing complex logic with temp tables, etc, you can likely achieve the same in Appian with a!queryEntity(),  much more easily.

Children