eval approach | const TEMPLATE_OBJECT = {
id: "household_record_page",
name: null,
isGlobal: null,
entityType: "_s_Household",
grants: [],
order: null,
roleIds: null,
buttons: null,
createdTime: 1705496417454,
modifiedTime: 1705496417453,
children: ["root"],
allComponents: {
"0": {
langVsTranslatedFieldValues: null,
id: "0",
templateId: "@sprinklr/widget/Layout",
persistedId: null,
name: null,
order: 0,
children: ["1", "2", "3"],
props: {
pageTemplate: "STICKY_HEADER_TWO_COLS_PINNED_LEFT",
colGap: 20,
leftColSpan: 13,
rightColSpan: 7,
className: "spr-ui-05 pr-4",
},
context: null,
uiEvents: null,
formLayout: null,
tableLayout: null,
buttons: null,
valueSource: null,
evaluatedValue: null,
translations: null,
},
"1": {
langVsTranslatedFieldValues: null,
id: "1",
templateId: "@sprinklr/widget/Layout",
persistedId: null,
name: "ONE",
order: 0,
children: ["1a", "1b"],
props: {
pageTemplate: "ONE_REGION",
},
context: null,
uiEvents: null,
formLayout: null,
tableLayout: null,
buttons: null,
valueSource: null,
evaluatedValue: null,
translations: null,
},
root: {
langVsTranslatedFieldValues: null,
id: "root",
templateId: "@sprinklr/widget/Layout",
persistedId: null,
name: null,
order: 0,
children: ["0"],
props: {
pageTemplate: "ONE_REGION",
stickyHeaderPresent: true,
},
context: null,
uiEvents: null,
formLayout: null,
tableLayout: null,
buttons: null,
valueSource: null,
evaluatedValue: null,
translations: null,
},
"1a": {
langVsTranslatedFieldValues: null,
id: "1a",
templateId: "@sprinklr/widget/Layout",
persistedId: null,
name: null,
order: 0,
children: ["1a1"],
props: {
pageTemplate: "ONE_REGION",
className: "ml-4 pr-4",
},
context: null,
uiEvents: null,
formLayout: null,
tableLayout: null,
buttons: null,
valueSource: null,
evaluatedValue: null,
translations: null,
},
"1a1": {
langVsTranslatedFieldValues: null,
id: "1a1",
templateId: "@sprinklr/widget/EntityControls",
persistedId: null,
name: "ONE",
order: 0,
children: null,
props: {
entityType: "_s_Household",
upfrontActionsCount: 4,
},
context: null,
uiEvents: null,
formLayout: null,
tableLayout: null,
buttons: [
{
langVsTranslatedFieldValues: null,
id: "OPEN_MEETING_RECORD_FORM",
templateId: "@sprinklr/action/OpenRecordForm",
persistedId: null,
label: "Schedule Meeting",
detail: null,
icon: "meeting",
entityType: "_s_Meeting",
action: null,
props: {
type: "ICON_TEXT_BUTTON",
recordFormVariant: "THIRD_PANE",
recordFormLayoutId: "finance_meeting",
title: "Schedule Meeting",
context: {
linkedEntityId: "_s_Household-:-${currentRecord?.entityId}",
attendees: "${currentRecord?.attendees}",
},
},
translations: null,
children: null,
visibility: null,
disabilityFilter: null,
payload: null,
},
{
langVsTranslatedFieldValues: null,
id: "OPEN_INTERACTION_RECORD_FORM",
templateId: "@sprinklr/action/OpenRecordForm",
persistedId: null,
label: "Log Interaction",
detail: null,
icon: "interaction",
entityType: "_s_Interaction",
action: null,
props: {
type: "ICON_TEXT_BUTTON",
recordFormVariant: "THIRD_PANE",
recordFormLayoutId: "finance_interaction",
title: "Log Interaction",
messageOnSuccess: "Successfully created the interaction",
context: {
linkedEntityId: "_s_Household-:-${currentRecord?.entityId}",
attendees: [
{
linkedEntityId:
"_s_Customer-:-${currentRecord?.values?._c_headCustomerId}",
},
],
relatedTo: [
"_s_Customer-:-${currentRecord?.values?._c_headCustomerId}",
],
},
},
translations: null,
children: null,
visibility: null,
disabilityFilter: null,
payload: null,
},
{
langVsTranslatedFieldValues: null,
id: "OPEN_SUPERVISOR_REVIEW_RECORD_FORM",
templateId: "@sprinklr/action/OpenRecordForm",
persistedId: null,
label: "Add Review",
detail: null,
icon: "interaction",
entityType: "_c_reviewforsupervisor",
action: null,
props: {
type: "ICON_TEXT_BUTTON",
recordFormVariant: "THIRD_PANE",
recordFormLayoutId: "household_review_form",
title: "Add Review",
messageOnSuccess: "Successfully created the review",
context: {
_c_wealthgroupidforreview: "${currentRecord?.entityId}",
name: "${currentRecord?.name} Review",
_c_wealthgroupheadforreview:
"${currentRecord?.values?._c_headCustomerId}",
_c_rm_user:
"${currentRecord?.shares?.jointGrants?.find(e => e?.endsWith('/WRM') && e?.startsWith('USER/'))?.split('/')?.[1]}",
},
},
translations: null,
children: null,
visibility: {
filterType: "AND",
filters: [],
filters_dummy: [
{
filterType: "EXPRESSION",
field:
"${currentRecord?.shares?.jointGrants?.find(e => e?.endsWith('/WRM') && e?.startsWith('USER/'))?.split('/')?.[1] !== currentUser.userId}",
},
{
filterType: "EXPRESSION",
field:
"${currentRecord?.shares?.jointGrants?.find(e => e?.endsWith('/IA') && e?.startsWith('USER/'))?.split('/')?.[1] !== currentUser.userId}",
},
{
filterType: "EXPRESSION",
field:
"${currentRecord?.shares?.jointGrants?.find(e => e?.endsWith('/SRM') && e?.startsWith('USER/'))?.split('/')?.[1] !== currentUser.userId}",
},
],
},
disabilityFilter: null,
payload: null,
},
{
langVsTranslatedFieldValues: null,
id: "INITIATE_WORKFLOW",
templateId: "@sprinklr/action/GuidedAction",
persistedId: null,
label: "Initiate Workflow",
detail: null,
icon: "workflow",
entityType: "_s_Household",
action: "254937",
props: {
type: "ICON_TEXT_BUTTON",
},
translations: null,
children: null,
visibility: null,
disabilityFilter: null,
payload: null,
},
],
valueSource: null,
evaluatedValue: null,
translations: null,
},
},
};
const CONTEXT = {
currentRecord: {
attendees: [{ id: "1", name: "Nik" }],
values: {
_c_headCustomerId: "123",
},
entityId: "123",
name: "Nikunj",
shares: { jointGrants: ["USER/123/WRM"] },
},
currentUser: {
userId: 123,
},
};
parseTemplateObject(TEMPLATE_OBJECT, CONTEXT);
| ready |
_template | const TEMPLATE_OBJECT = {
id: "household_record_page",
name: null,
isGlobal: null,
entityType: "_s_Household",
grants: [],
order: null,
roleIds: null,
buttons: null,
createdTime: 1705496417454,
modifiedTime: 1705496417453,
children: ["root"],
allComponents: {
"0": {
langVsTranslatedFieldValues: null,
id: "0",
templateId: "@sprinklr/widget/Layout",
persistedId: null,
name: null,
order: 0,
children: ["1", "2", "3"],
props: {
pageTemplate: "STICKY_HEADER_TWO_COLS_PINNED_LEFT",
colGap: 20,
leftColSpan: 13,
rightColSpan: 7,
className: "spr-ui-05 pr-4",
},
context: null,
uiEvents: null,
formLayout: null,
tableLayout: null,
buttons: null,
valueSource: null,
evaluatedValue: null,
translations: null,
},
"1": {
langVsTranslatedFieldValues: null,
id: "1",
templateId: "@sprinklr/widget/Layout",
persistedId: null,
name: "ONE",
order: 0,
children: ["1a", "1b"],
props: {
pageTemplate: "ONE_REGION",
},
context: null,
uiEvents: null,
formLayout: null,
tableLayout: null,
buttons: null,
valueSource: null,
evaluatedValue: null,
translations: null,
},
root: {
langVsTranslatedFieldValues: null,
id: "root",
templateId: "@sprinklr/widget/Layout",
persistedId: null,
name: null,
order: 0,
children: ["0"],
props: {
pageTemplate: "ONE_REGION",
stickyHeaderPresent: true,
},
context: null,
uiEvents: null,
formLayout: null,
tableLayout: null,
buttons: null,
valueSource: null,
evaluatedValue: null,
translations: null,
},
"1a": {
langVsTranslatedFieldValues: null,
id: "1a",
templateId: "@sprinklr/widget/Layout",
persistedId: null,
name: null,
order: 0,
children: ["1a1"],
props: {
pageTemplate: "ONE_REGION",
className: "ml-4 pr-4",
},
context: null,
uiEvents: null,
formLayout: null,
tableLayout: null,
buttons: null,
valueSource: null,
evaluatedValue: null,
translations: null,
},
"1a1": {
langVsTranslatedFieldValues: null,
id: "1a1",
templateId: "@sprinklr/widget/EntityControls",
persistedId: null,
name: "ONE",
order: 0,
children: null,
props: {
entityType: "_s_Household",
upfrontActionsCount: 4,
},
context: null,
uiEvents: null,
formLayout: null,
tableLayout: null,
buttons: [
{
langVsTranslatedFieldValues: null,
id: "OPEN_MEETING_RECORD_FORM",
templateId: "@sprinklr/action/OpenRecordForm",
persistedId: null,
label: "Schedule Meeting",
detail: null,
icon: "meeting",
entityType: "_s_Meeting",
action: null,
props: {
type: "ICON_TEXT_BUTTON",
recordFormVariant: "THIRD_PANE",
recordFormLayoutId: "finance_meeting",
title: "Schedule Meeting",
context: {
linkedEntityId: "_s_Household-:-${currentRecord?.entityId}",
attendees: "${currentRecord?.attendees}",
},
},
translations: null,
children: null,
visibility: null,
disabilityFilter: null,
payload: null,
},
{
langVsTranslatedFieldValues: null,
id: "OPEN_INTERACTION_RECORD_FORM",
templateId: "@sprinklr/action/OpenRecordForm",
persistedId: null,
label: "Log Interaction",
detail: null,
icon: "interaction",
entityType: "_s_Interaction",
action: null,
props: {
type: "ICON_TEXT_BUTTON",
recordFormVariant: "THIRD_PANE",
recordFormLayoutId: "finance_interaction",
title: "Log Interaction",
messageOnSuccess: "Successfully created the interaction",
context: {
linkedEntityId: "_s_Household-:-${currentRecord?.entityId}",
attendees: [
{
linkedEntityId:
"_s_Customer-:-${currentRecord?.values?._c_headCustomerId}",
},
],
relatedTo: [
"_s_Customer-:-${currentRecord?.values?._c_headCustomerId}",
],
},
},
translations: null,
children: null,
visibility: null,
disabilityFilter: null,
payload: null,
},
{
langVsTranslatedFieldValues: null,
id: "OPEN_SUPERVISOR_REVIEW_RECORD_FORM",
templateId: "@sprinklr/action/OpenRecordForm",
persistedId: null,
label: "Add Review",
detail: null,
icon: "interaction",
entityType: "_c_reviewforsupervisor",
action: null,
props: {
type: "ICON_TEXT_BUTTON",
recordFormVariant: "THIRD_PANE",
recordFormLayoutId: "household_review_form",
title: "Add Review",
messageOnSuccess: "Successfully created the review",
context: {
_c_wealthgroupidforreview: "${currentRecord?.entityId}",
name: "${currentRecord?.name} Review",
_c_wealthgroupheadforreview:
"${currentRecord?.values?._c_headCustomerId}",
_c_rm_user:
"${currentRecord?.shares?.jointGrants?.find(e => e?.endsWith('/WRM') && e?.startsWith('USER/'))?.split('/')?.[1]}",
},
},
translations: null,
children: null,
visibility: {
filterType: "AND",
filters: [],
filters_dummy: [
{
filterType: "EXPRESSION",
field:
"${currentRecord?.shares?.jointGrants?.find(e => e?.endsWith('/WRM') && e?.startsWith('USER/'))?.split('/')?.[1] !== currentUser.userId}",
},
{
filterType: "EXPRESSION",
field:
"${currentRecord?.shares?.jointGrants?.find(e => e?.endsWith('/IA') && e?.startsWith('USER/'))?.split('/')?.[1] !== currentUser.userId}",
},
{
filterType: "EXPRESSION",
field:
"${currentRecord?.shares?.jointGrants?.find(e => e?.endsWith('/SRM') && e?.startsWith('USER/'))?.split('/')?.[1] !== currentUser.userId}",
},
],
},
disabilityFilter: null,
payload: null,
},
{
langVsTranslatedFieldValues: null,
id: "INITIATE_WORKFLOW",
templateId: "@sprinklr/action/GuidedAction",
persistedId: null,
label: "Initiate Workflow",
detail: null,
icon: "workflow",
entityType: "_s_Household",
action: "254937",
props: {
type: "ICON_TEXT_BUTTON",
},
translations: null,
children: null,
visibility: null,
disabilityFilter: null,
payload: null,
},
],
valueSource: null,
evaluatedValue: null,
translations: null,
},
},
};
const CONTEXT = {
currentRecord: {
attendees: [{ id: "1", name: "Nik" }],
values: {
_c_headCustomerId: "123",
},
entityId: "123",
name: "Nikunj",
shares: { jointGrants: ["USER/123/WRM"] },
},
currentUser: {
userId: 123,
},
};
templateObject2(TEMPLATE_OBJECT, CONTEXT);
| ready |