I have a script to create a concatenated string (thanks Cyril). It works great in workflow under
On Add/On Success and On
Edit/On Success.
What I would like to do is to put this script into a function and just call it in the workflow that way.
I tried creating a new function and added the script. I saved it and called it in the workflow. No go when run. Blank. I go back to the script editor and the script is gone except for the bit on top for the string. Tried it a few more times, same result. Also if I try to use the script builder none of fields show up.
Does anyone have an idea what might be happening here? I would really love to start getting my workflow scripting under control by using functions.
-- Greg
Here is how I call the function in the workflow:
thisapp.POSAutoTitle();
Here is the function script:
string POSAutoTitle()
{
return "";
}
// convert date field
convertDate = input.Start_Date.toString("yyyy/MM/dd");
// Return Practice Center abbreviation
if (input.Practice_Center == "City Center")
{
convertCenter = "CC";
}
else if (input.Practice_Center == "Green Gulch Farm")
{
convertCenter = "GGF";
}
else if (input.Practice_Center == "Zen Mountain Center")
{
convertCenter = "ZMC";
}
else
{
convertCenter = "Other";
}
// get 16 first characters of title
shortTitle = input.Title.substring(0,16);
// return POS title (concatenate)
input.POS_Title = convertDate + " " + convertCenter + " " + shortTitle;