Allows to create an Entity from the JSON or to read an Entity from the Variable. Using Cast To Entity after Get Variable allows to make a flowchart even more readable by getting rid of links of entity between operators.
inputs:
module – link or select directly in the operator the Module which entity should be in the output.
- Required: yes
value – input JSON that describes entity or link from value with the entity from the Get Variable
- Required: yes
outputs:
entity – the entity that can be used in Get Entity Attributes, Save Entity, and other operators that requires entity as input
Example of usage:
- Creating Entity from the JSON
For example, there is a JSON that describes an object in a similar way as Sugar Entity structure. Instead of operators Create Entity and Set Entity Attributes following with mapping fields from JSON to Sugar Entity, there is a possibility to use Cast To Entity. Let’s say there is a JSON like this:
{
"first_name": "Clark",
"last_name": "Kent"
}
With the following flowchart, it is possible to create a new Contact record from this JSON:
As a result, new Contact is added.
2. Get Entity from the Variable
If you have dozens of links from entity port:
… and have ever thought of how to remove them to make flowchart even more readable – now it is possible to put Entity in a Variable and then simply use this Variable through Cast To Entity. Put entity into variable:
And then through Get Variable and Cast To Entity use the entity whenever it is needed: