The Asite API functions will be used to exchange data across AppBuilder Forms.
List of API functions required for exchanging data across AppBuilder forms
# |
API Function |
Resultant data details |
1. |
getFormType_WS |
List of Form Types within the specified workspace (returns the list for the workspace into which the user is logged in by default if workspace id is not specified) |
2. |
getCustomFormFields |
Lists the data fields in the XSN of the specified Form Type |
3. |
getFormDetails |
Details of the specified form |
4. |
getFormsbyDynamicSearch |
Returns values of the specified form data fields, from the forms depending upon the formTypeID and the search criteria specified |
|
|
|
Sequence of API functions to be called:
1.To retrieve data form multiple forms depending upon a search criteria
getFormType_WS ==> getCustomFormFields ==> getFormsbyDynamicSearch
2. To retrieve data form a specific form
getFormType_WS ==> getFormDetails
Step by Step Guide to retrieve data from an existing form Instance
Forms:
1. Data_ Master_Form
2. Data_Query_Form
Create Forms:
Data_ Master_Form –basic data entry form
Data_Query_Form – to retrieve data from Data_ Master_Form form using Asite API function
1. Add web service functions as data connections
Select data connections from the tools menu in InfoPath
Specify the location of web service
Select the webService API function
Name the data connection, which is generally named same as the API function, as a process, but may be named differently at the user’s will.
The data connection will be available as secondary data source in the XSN.
Query Fields are input parameter for the API function call.
The data fields are the output fields and return back the result of the API call.
The output retrieved is in XML format and can be used to display it in the format as and when required.
Form Load Event – call getFormType_WS function
This will return a list of FormTypes to which the logged in user has access to in the current Workspace.
1. Button click event – reads the XML data returned by getFormType_WS
2. Read XML data returned by getFormType_WS
3. Write a rule to get the data from the getFormType_WS function on the button
This will assign the return value to WS_FormTypes field in the form and will trigger change event for – WS_FormTypes field (data field in XSN)
From within WS_FormTypes field’s - change event write the script to
Pick up the Form Type ID of the Data_ Master_Form from the resultant XML from the field in data fields group in the secondary data source
Read Custom Form Fields of Employee Form by calling getCustomFormFields API Function.
Refer the following XML data that is returned by each API function:
1. getFormType_WS
<?xml version="1.0" encoding="ISO-8859-1"?>
<asiteDataList>
<FormTypeGroup>
<FormGroupName>Asite Employees</FormGroupName>
<FormType>
<FormTypeID>96680$$ZBZDQn</FormTypeID>
<FormName>Asite Employees</FormName>
<URI>https://developer.asite.com/api/workspace/55119$$C8qfBQ/form/firstpage/formlist/96ZBZDQn</URI>
<URI>https://developer.asite.com/api/workspace/55119$$C8qfBQ/form/firstpage/incompleteactionformlist/96ZBZDQn</URI>
<URI>https://developer.asite.com/api/workspace/55119$$C8qfBQ/form/reportformlist/96680$$ZBZDQn</URI>
</FormType>
<FormType>
<FormTypeID>97118$$o67CXT</FormTypeID>
<FormName>Asite Employees Daily Muster</FormName>
<URI>https://developer.asite.com/api/workspace/55119$$C8qfBQ/form/firstpage/formlist/9767CXT</URI> <URI>https://developer.asite.com/api/workspace/$C8qfBQ/form/firstpage/incompleteactionformlist/97118$$o67CXT</URI> <URI>https://developer.asite.com/api/workspace/$C8qfBQ/form/reportformlist/97118$$o67CXT</URI>
</FormType>
</FormTypeGroup>
</asiteDataList>
2. getCustomFormFields
<?xml version="1.0" encoding="ISO-8859-1"?>
<asiteDataList>
<form-field-vO field-id="0" is-mandatory="false" is-readonly="false" is-single="false">
<field-name>Active</field-name>
<xpath>/myFields/FORM_CUSTOM_FIELDS/ORI_MSG_CUSTOM_FEILDS/EmployeeMasterDetails/Active</xpath>
</form-field-vO>
<form-field-vO field-id="0" is-mandatory="false" is-readonly="false" is-single="false">
<field-name>Department</field-name>
<xpath>/myFields/FORM_CUSTOM_FIELDS/ORI_MSG_CUSTOM_FEILDS/EmployeeMasterDetails/Department</xpath>
</form-field-vO>
<form-field-vO field-id="0" is-mandatory="false" is-readonly="false" is-single="false">
<field-name>Designation</field-name>
<xpath>/myFields/FORM_CUSTOM_FIELDS/ORI_MSG_CUSTOM_FEILDS/EmployeeMasterDetails/Designation</xpath>
</form-field-vO>
<form-field-vO field-id="0" is-mandatory="false" is-readonly="false" is-single="false">
<field-name>DOJoining</field-name>
<xpath>/myFields/FORM_CUSTOM_FIELDS/ORI_MSG_CUSTOM_FEILDS/EmployeeMasterDetails/DOJoining</xpath>
</form-field-vO>
<form-field-vO field-id="0" is-mandatory="false" is-readonly="false" is-single="false">
<field-name>DS_APPROVEDBY</field-name>
<xpath>/myFields/Asite_System_Data_Read_Only/_5_Form_Data/Status_Data/DS_APPROVEDBY</xpath>
</form-field-vO>
<form-field-vO field-id="0" is-mandatory="false" is-readonly="false" is-single="false">
<field-name>DS_APPROVEDON</field-name>
<xpath>/myFields/Asite_System_Data_Read_Only/_5_Form_Data/Status_Data/DS_APPROVEDON</xpath>
</form-field-vO>
<form-field-vO field-id="0" is-mandatory="false" is-readonly="false" is-single="false">
<field-name>DS_ATTACHMENTS_ORI</field-name>
<xpath>/myFields/Asite_System_Data_Read_Only/_6_Form_MSG_Data/ORI_MSG_Data/DS_ATTACHMENTS_ORI</xpath>
</form-field-vO>
<form-field-vO field-id="0" is-mandatory="false" is-readonly="false" is-single="false">
<field-name>DS_ATTRIBUTES</field-name>
<xpath>/myFields/Asite_System_Data_Read_Only/_5_Form_Data/DS_ATTRIBUTES</xpath>
</form-field-vO>
<form-field-vO field-id="0" is-mandatory="false" is-readonly="false" is-single="false">
<field-name>DS_CLOSEDUEDATE</field-name>
<xpath>/myFields/Asite_System_Data_Read_Only/_5_Form_Data/Status_Data/DS_CLOSEDUEDATE</xpath>
</form-field-vO>
<form-field-vO field-id="0" is-mandatory="false" is-readonly="false" is-single="false">
<field-name>DS_CONTROLLERNAME</field-name>
<xpath>/myFields/Asite_System_Data_Read_Only/_5_Form_Data/DS_CONTROLLERNAME</xpath>
</form-field-vO>
<form-field-vO field-id="0" is-mandatory="false" is-readonly="false" is-single="false">
<field-name>DS_DATEOFISSUE</field-name>
<xpath>/myFields/Asite_System_Data_Read_Only/_5_Form_Data/DS_DATEOFISSUE</xpath>
</form-field-vO>
<form-field-vO field-id="0" is-mandatory="false" is-readonly="false" is-single="false">
<field-name>DS_FORMID</field-name>
<xpath>/myFields/Asite_System_Data_Read_Only/_5_Form_Data/DS_FORMID</xpath>
</form-field-vO>
</asiteDataList>
Useful Links: