Perform Check is API Builder functionality that allows using if/then statements in a user-friendly way. It checks whether certain conditions are met, and if so, executes the command wrapped between two tags - Perform Check and Close Perform Check.
When Perform Check Should Be Used?
1. Conditional Fields - when we need to pass or to hide parameters depending on a certain condition. For example, buyer API requires the information about start and expiration dates of the insurance policy only if the person is insured. In this case, the necessary fields are mapped inside Perform Check tags and they are sent only if the corresponding condition is reached. Otherwise (e.g. if the person is not insured), fields mapped inside Perform Check tags are not included in the request.
2. If we need to pass different data depending on whether there is a certain field or a field value. For example, buyer specification requires haveInsurance parameter to be set to 1 (Yes) if the person is insured, and 0 (No) if not. In this case, Perform Check is configured for each of these two conditions.
3. When a certain field is required by Buyer Specification, but is not mandatory on PX side. Then Perform Check is used to check if the lead contains this parameter, and if yes to send corresponding value in the request. Otherwise, a hardcoded value is sent.
Basic Perform Check Mapping Flow
1. Map the parameter using Perform Check and Close Perform Check tags in the Template Editor.
2. Click on each Perform Check tag and configure appropriate conditions on the Mapping Panel.
3. Place the value or map parameters that should be displayed for each condition you have configured.
Examples below describe the mapping process for each Template editor format (HTTP, XML, SOAP and JSON) for haveInsurance parameter (indicates whether driver1 has a current auto insurance policy or not: 0=No, 1=Yes) and four parameters required only if haveInsurance=1(Yes):
- insuranceCompany;
- current_policy_start_date;
- current_policy_expiration_date;
- continuously_insured_period.
There are also useful Perform Check examples for several verticals.
Perform Check Mapping Flow in HTTP
Follow these instructions:
1) Enter haveInsurance={ and find Perform check in the field list. Then enter 1 and put Close Perform check tag:
2) Repeat the same actions for 0 value:
3) Map the field options using Mapping Panel by placing the cursor on the first PerformCheck tag:
- select Insurance Company in Check field dropdown menu;
- select Not equals in Check type dropdown menu;
- select Currently not insured in Check value dropdown menu:
4) Place the cursor on the PerformCheck~1 tag and map the field options for haveInsurance=0 condition:
According to these configurations, PX system will check whether the driver from the Lead is insured or not and assign appropriate values (0 or 1), which are accepted by buyer.
The next four fields (insuranceCompany, current_policy_start_date, current_policy_expiration_date, continuously_insured_period) are required only if haveInsurance=1(Yes). In this case, Perform Check should be used as well, so that PX system first checks haveInsurance field, and then decides whether to use next four fields or not.
Use the following instructions:
1) Put Perform Check and Close Perform Check tags:
2) Specify the condition on the Mapping Panel (haveInsurance=1(Yes)):
3) Map all the fields and their options that are required if haveInsurance=1 inside the PerformCheck tag (do not forget to put & before the first field):
Pay attention if all Perform Check tags are placed correctly and check the following:
- All closing tags for Perform Check exist and are not duplicated.
- All opening Perform check tag numbers correspond to closing tag numbers.
- If you have Perform Check configured inside other Perform Check tags, make sure the second Close Perform Check tag is closed before the first one.
Perform Check Mapping Flow in XML and SOAP
Follow these instructions:
1) Enter a haveInsurance tag and find Perform check in the field list. Then enter 1{ and select Close Perform check.
2) Repeat the same actions for 0 value:
3) Map the field options using Mapping Panel by placing the cursor on the first PerformCheck tag:
- select Insurance Company in Check field dropdown menu;
- select Not equals in the Check type dropdown menu;
- select Currently not insured in Check value dropdown menu:
4) Place the cursor on the PerformCheck~1 tag and map the field options for haveInsurance=0 condition:
According to these configurations, PX system will check if the driver from the Lead is insured or not and assign appropriate values (0 or 1), which are accepted by buyer.
The next four fields (insuranceCompany, current_policy_start_date, current_policy_expiration_date, continuously_insured_period) are required only if haveInsurance=1(Yes). In this case, Perform Check should be used as well, so that PX system first checks haveInsurance field, and then decides whether to use next four fields or not.
Use the following instructions:
1) Put Perform Check and Close Perform Check tags:
2) Specify the condition on Mapping Panel (haveInsurance=1(Yes)):
3) Map all the fields (and their options) that are required if haveInsurance=1 inside PerformCheck tags:
Perform Check Mapping Flow in JSON
In JSON Template Editor, each parameter should be specified only once. However, sometimes you need to specify the same parameter several times to indicate different conditions. In such cases, put the parameter inside Perform Check tags each time it is repeated.
In our example, we have two conditions for the same parameter, that is why the parameter will be put inside Perform Check tags.
Follow these instructions:
1) Enter “haveInsurance”:”1” between two Perform Check and Close Perform Check tags:
2) Repeat the same actions for 0 value:
4) Map the field options using Mapping Panel by placing the cursor on the first PerformCheck tag:
- select Insurance Company in Check field dropdown menu;
- select Not equals in the Check type dropdown menu;
- select Currently not insured in Check value dropdown menu:
5) Place the cursor on the PerformCheck~1 tag and map the field options for haveInsurance=0 condition:
According to these configurations, PX system will check if the driver from the Lead is insured or not and assign appropriate values (0 or 1), which are accepted by buyer.
The next four fields (insuranceCompany, current_policy_start_date, current_policy_expiration_date, continuously_insured_period) are required only if haveInsurance=1(Yes). In this case, Perform Check should be used as well, so that PX system first checks haveInsurance field, and then decides whether to use next four fields or not.
Use the following instructions:
1) Put Perform Check and Close Perform Check tags:
2) Specify the condition on Mapping Panel (haveInsurance=1(Yes)):
3) Map all the fields (and their options) that are required if haveInsurance=1 inside PerformCheck tags:
Whenever you specify the parameter multiple times, make sure to put each of them inside opening and closing Perform Check tags. Otherwise, fields and conditions will not be mapped properly.
Read this article for additional examples for different fields and verticals.
0 comments
Please sign in to leave a comment.