Libraries and Scripts
Server Side Script Libraries
This library contains functions used to check if the added configuration is correct.
Functions:
checkExistingCardInsurancePersonaCard(insurancePersonaCardId, insurancePersonaId, cardId)
This function checks if a card is already linked to an insurance persona, when adding or updating a card on an insurance persona (insures uniqueness on the combination insurancePersonaId and cardId).
Input parameters:
-
insurancePersonaCardId - id of the current record being added/updated
-
insurancePersonaId - id of the insurance persona for which we are searching the allocations
-
cardId - id of the card we are searching for
Output parameters:
-
N/A
checkExistingVersionCardItemConfigXVersion(cardItemConfigXVersionid, cardItemConfigId, versionId)
This function checks if a card version is already linked to a card item config, when adding or updating a version (insures uniqueness on the combination cardItemConfigId and versionId).
Input parameters:
-
cardItemConfigXVersionid- id of the current record being added/updated
-
cardItemConfigId- id of the card item config for which we are searching the allocations
-
versionId- id of the version of the card we are searching for
Output parameters:
-
N/A
setNewHighlightedInsurancePersonaCard(insurancePersonaCardId, insurancePersonaId)
This function marks all the cards assigned on an insurance persona and not being highlighted, with the exception of the current insurancePersonaCardId, sent as a parameter.
Input parameters:
-
insurancePersonaCardId- id of a record from FTOS_IP_InsurancePersonaCard entity that is the new highlighted one; this record will not be updated
-
insurancePersonaId- id of the insurance persona for which we are searching cards allocations
Output parameters:
-
N/A
setNewDefaultCardItemConfigVersion(cardItemConfigXVersionid, cardItemConfigId)
Marks all card versions allocated on a certain card item config as not being default, with the exception of the current cardItemConfigXVersionid, sent as a parameter.
Input parameters:
-
cardItemConfigXVersionid- id of a record from FTOS_IP_CardItemConfigxVersion entity that is the new default one; this record will not be updated
-
cardItemConfigId- id of the card item config for which we are searching allocations
Output parameters:
-
N/A
This library contains functions used to read data from the Proposal Configurator entities.
Functions (most important ones):
getMatchedInsurancePersona(mainEntityName, mainEntityId)
This function is used to identify the insurance persona based on the provided answers. It identifies all the insurance personas included in the quote config selected in the quote. For each insurance persona, checks if the mainEntityId record is in the audience or in the segment attached to the insurance persona.
Input parameters:
-
mainEntityName - name of the entity extending the
FTOS_INSQB_Quoteentity (likeFTOS_INSQB_QuoteProperty) -
mainEntityId - ID of a record from mainEntityName
Output parameters:
-
matchedInsurancePersonaId - uniqueidentifier, ID of the insurance persona idenfied or null
getCardsByInsurancePersonaId(insurancePersonaId)
This function is used to get all the cards configured for a specific insurance persona
Input parameters:
-
insurancePersonaId - ID of the insurance persona to search for
Output parameters:
-
cardArray - array of objects containing details about the cards, with the following keys: cardId, displayname, code, isHighlighted, personaCardOrder
insertVersionRelatedRecords(mainEntityName, mainEntityId)
This function calls the previously mentioned functions in order to calculate the premium amount for each card:
-
evaluates the responses provided to the DNT questions and determines the insurance persona
-
reads all the cards defined for an insurance persona and saves the details for each in the
FTOS_INSQB_QuoteVersionentity, without having the premium amount calculated yet -
gets the card items for each card and calculates the premium for each card item, saving the results in the
FTOS_INSQB_QuoteVersionItementity -
updates the total premium on each record from the
FTOS_INSQB_QuoteVersion entity, previously inserted
Input parameters:
-
mainEntityName - name of the entity extending the FTOS_INSQB_Quote entity (like FTOS_INSQB_QuoteProperty)
-
mainEntityId- id of a record from mainEntityName
Output parameters:
-
N/A
getCardsInformationForDisplay(mainEntityName, mainEntityId, customConditionList)
This function returns details about the cards, including premium details saved in the FTOS_INSQB_QuoteVersion entity and information about all the premiums calculated for each card version
Input parameters:
-
mainEntityName - name of the entity extending FTOS_INSQB_Quote entity (like FTOS_INSQB_QuoteProperty)
-
mainEntityId- id of a record from mainEntityName
-
customConditionList - additional conditions used to filter the details
Output parameters:
-
cardDisplayInformation - array of objects containing the following keys:
[{
"quoteVersionId": "18363122-4670-44a8-a04b-3a4f5e9d77f1",
"code": "D",
"displayName": "COMPLETE",
"premiumAmount": 134.66,
"currencyName": null,
"isHighlighted": false,
"orderIndex": 3.0,
"cardId": "0955c095-eeac-447a-a7c8-5151280dc5f6",
"isFinalQuote": true,
"cardItemDisplayInformation": [CardItemVersion1, CardItemVersion2]
}]
where CardItemVersion =
{
"quoteVersionItemId": "00564575-64c9-4ebc-aefd-3a81b9f32f37",
"insuranceOptionList": [
{
"insuranceOptionName": "option1",
"sumInsured": null,
"premiumAmount": 115.2,
"isSelected": true,
"orderIndex": 1.0
},
{
"insuranceOptionName": "option3",
"sumInsured": null,
"premiumAmount": 384.0,
"isSelected": false,
"orderIndex": 3.0
},
{
"insuranceOptionName": "option2",
"sumInsured": null,
"premiumAmount": 288.0,
"isSelected": false,
"orderIndex": 2.0
}
],
"displayName": "Content",
"isActive": true,
"icon": null,
"descriptionHTML": null,
"description": null,
"orderIndex": 2.0
}
getCardItemsByCardId(cardId)
This function is used to get all the card items (all the coverages) from a card.
Input parameters:
-
cardId - if of the card for which we are searching for items
Output parameters:
-
cardItemArray - array of objects describing a card item, with the following keys: cardItemId, code, displayName, icon, descriptionHTML,description, isActive ,cardItemOrder, insuranceProductId, insuranceItemId
This set of functions is used by the quote flow to interact with the proposal configurator settings.
Functions:
getAvailableQuestions(insuranceTypeId, quoteConfigId, quoteId)
This function returns all the DNT questions included in a quote config.
Input parameters:
-
insuranceTypeId – id of an insurance type used when searching for questions
-
quoteConfigId– id of a quote config used when searching for questions
-
quoteId – id of a FTOS_INSQB_Quote record from where the search started
Output parameters:
-
questions - array of elements containing the following keys: questionId, configCode, quoteConfigId
getQuestionInformation(questionId)
This function is used to get details about a DNT question.
Input parameters:
-
questionId – ID of a DNT question
Output parameters:
-
questionInfo- object containing the following keys: questionId, name, description, tooltip
getQuestionAnswers(questionId)
This function is used to get the available answers for a DNT question.
Input parameters:
-
questionId - ID of a DNT question
Output parameters:
-
questionInfo- array of object containing the following keys: answerId, name, code, description, isDefault
getDefaultOrSelectedQuestionAnswers(questionId, quoteId, answerList)
This function is used to identify is a certain answer is default of if an answer was already provided for a question.
Input parameters:
-
questionId - id of a DNT question
-
quoteId - if of the quote from where the search started
-
answerList - list of available answers for a DNT question, as returned by getQuestionAnswers; if this parameter is not provided, the function will call getQuestionAnswers to identify the list of answers
Output parameters:
-
questionInfo- array of object containing the following keys: answerId, name, code, description, isDefault
-
choosedAnswer - object containing the following keys : answerId - the answer that will be automatically displayed, isDefault - if the answer is the default one, than it cannot be changed
saveDNTAnswears(quoteId, dntResponses)
This function is used to save the answers to the DNT question in FTOS_IP_DNTQuestionProvidedAnswer entity. Before saving the answers, it also deletes any other previously provided answers.
Input parameters:
-
quoteId - if of the quote for which we are saving the responses
-
dntResponses - array of object containing questionId and answerValue keys; answer value can be either true or false
Output parameters:
-
N/A
This library contains general functions used to check if values are null, to validate a certain format of a date, and to validate different option set item names.