Target Information

The Target Information field is used to collect all the needed information to call a target such as a TSQL stored procedure, API, etc.

Component Code

The first section of the code for the component contains the standard parameter set for field components along with the variables needed for the component to function. Following the variables are the methods used by the component which are listed below.

OnParametersSetAsync()

This method is called when the component is first initialized and when there’s an update to its parent component. Its purpose is to assign values to all the variables for the component to display and be correctly be populated.

ValueChanged()

This method is called when any value is changed. Its purpose is to validate the field is modifiable, validate the fields, then finally call ChangeXML() if there are no validation errors.

ChangeXML()

This method is called by ValueChanged(). Its purpose is to create the XML and add it to the instances DataChanges.

This is an example of the XML structure that is saved:

//API
<TargetInformationField>
    <TargetType>API</TargetType>
    <APITarget>YourAPITarget</APITarget>
    <APIName>YourAPIName</APIName>
    <APIAsyncOption>Yes</APIAsyncOption>
    <APICommandQueue>NameOfCommandQueue</APICommandQueue>
    <ReturnOption>String</ReturnOption>
    <LockInstance>Yes</LockInstance>
    <LockInstanceTimeout>10</LockInstanceTimeout>
</TargetInformationField>

//TSQL
<TargetInformationField>
    <TargetType>TSQL</TargetType>
    <TSQLStoredProcedure>NameOfTSQL</TSQLStoredProcedure>
    <ReturnOption>None</ReturnOption>
    <LockInstance>Yes</LockInstance>
    <LockInstanceTimeout>20</LockInstanceTimeout>
</TargetInformationField>

//DataModel
<TargetInformationField>
    <TargetType>DataModel</TargetType>
    <DataModelCommand>NameOfCommand</DataModelCommand>
    <ReturnOption>DataSet</ReturnOption>
    <LockInstance>No</LockInstance>
</TargetInformationField>

ClearFalseValidationMessages()

This method is called by ValueChanged(). Its purpose is to clear any false validation messages related to this field off the page. False validation messages can occur if the field is required and the user selected a target type, then changed to a different target type. This is because all the fields from the initial target selection are validated and when the selection changed those fields still have their empty validation messaged stored on the form and need to be cleared to prevent false negatives, preventing the user from saving the form.

Updated on October 16, 2023

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support

Leave a Comment