I have an action to Create an object and I want to auto-populate the Title parameter as a concatenation of some of the other parameters.
eg. Client Name = Toy Company Ltd
Target = New Revenue
Amount = $10,0000
and I want the title to be:
Title = New Revenue for Toy Company Ltd
so Target + " for " + Client Name
This used to be possible in Foundry Forms, but I can’t figure out how to make parameters in the Action form be a function of other parameters.
Are there any ways to do this? or other suggestions for how to auto-create a reasonable Title property automatically? Could it be done on the Workshop side instead?
I think the most straightforward way to achieve that functionality is by creating a variable and using that to configure the parameter on action form within the Workshop.
If you go to Variables → New → String → Variable Transformation → String Concatenation you can concat the ClientName and the Target variable, and then use the resulting value for the Action form.
Hi! There isn’t a first class way to do this currently but here are two ways that you can get around this issue.
Using Workshop Variables: Store your object parameters as Workshop variables and then use an additional workshop variable that concats the two with your desired delimiter (“for”). In this instance you would need to create a form as parameters applied to action forms are not directly accessible to Workshop.
Switching to a function-backed action: This gives you the freedom to engage with the parameters provided however you wish. In this case, Client Name and Target would be two parameters that you can then write to your object property title like so.
@OntologyEditFunction
async createNewObject(clientName:string, target: string, amount, integer):Promise<void>{
const title = clientName.concat(" for ", target);
const object = Objects.create().object();
object.title = title;
object.clientName = clientName;
object.target = target;
object.amount = amount;
...
//rest of properties defined here.
}