How to save value of local variable defined in with() section, into a rule input

 Scenario:

 

Trying to save repopulated values into rule input. The prepopulated values are stored in a local variable that is defined in a with() section as in below code. Need to map this value from local variable defined in With() section into rule input. Please advise?

 

with(
/*Replace with your rule to get the employee details */
local!selectedEvent: rule!GetEventByIdExpressionRule(local!selectedEventId),
a!sectionLayout(
label: "Event Details for Event: ",
contents: {
a!columnsLayout(
columns: {
a!columnLayout(
contents: {
a!integerField(
label: "Id",
value: local!selectedEvent.Id,
saveInto: a!save(ri!Event.Id, save!value),
readOnly: true
),
a!textField(
label: "Team",
value: local!selectedEvent.Team,
readOnly: true
)
}
),
a!columnLayout(
contents: {
a!textField(
label: "Requested Date",
value: local!selectedEvent.RequestedDate,
readOnly: true
),
a!dropdownField(
label: "Status",
labelPosition: "ABOVE",
placeholderLabel: "--- Select a Value ---",
choiceLabels: local!statusTypes.Status,
choiceValues: local!statusTypes.Status,
value: ri!Event.Status,
saveInto: a!save(ri!Event.Status, save!value)
)
}
),
a!columnLayout(
contents: {
a!textField(
label: "Sent For Publishing",
value: local!selectedEvent.SentForPublishing,
readOnly: true
),
a!textField(
label: "Published On KLS",
value: local!selectedEvent.PublishedOnKls,
readOnly: true
)
}
)
}
),
a!buttonArrayLayout(
buttons: {
a!buttonWidget(
label: "Cancel",
saveInto: {},
style: "DESTRUCTIVE"
),
a!buttonWidgetSubmit(
label: "Update",
saveInto: rule!UpdateEvent(
ri!Event,
fv!result,
fv!error
),
style: "PRIMARY"
)
},
align: "START"
)
},
showWhen: not(
isnull(
local!selectedEventId
)
)
)
)

  Discussion posts and replies are publicly visible

Parents
  • Hi Anusha,

    Why are we defining local variable local!selectedEvent in with as local!selectedEventId is not updating in whole code and if it is is changing basis of any variable than we can define this on that component like

    a!save(
    ri!selectedEvent,rule!GetEventByIdExpressionRule(local!selectedEventId)
    )


    you can refer this code

    load(
    /*Replace with your rule to get the employee details */
    local!selectedEvent: rule!GetEventByIdExpressionRule(local!selectedEventId),
    a!sectionLayout(
    label: "Event Details for Event: ",
    contents: {
    a!columnsLayout(
    columns: {
    a!columnLayout(
    contents: {
    a!integerField(
    label: "Id",
    value: local!selectedEvent.Id,
    saveInto:
    {a!save(ri!Event.Id, save!value),
    a!save(ri!selectedEvent,rule!GetEventByIdExpressionRule(local!selectedEventId))
    },
    readOnly: true
    ),
    a!textField(
    label: "Team",
    value: local!selectedEvent.Team,
    readOnly: true
    )
    }
    ),
    a!columnLayout(
    contents: {
    a!textField(
    label: "Requested Date",
    value: local!selectedEvent.RequestedDate,
    readOnly: true
    ),
    a!dropdownField(
    label: "Status",
    labelPosition: "ABOVE",
    placeholderLabel: "--- Select a Value ---",
    choiceLabels: local!statusTypes.Status,
    choiceValues: local!statusTypes.Status,
    value: ri!Event.Status,
    saveInto: a!save(ri!Event.Status, save!value)
    )
    }
    ),
    a!columnLayout(
    contents: {
    a!textField(
    label: "Sent For Publishing",
    value: local!selectedEvent.SentForPublishing,
    readOnly: true
    ),
    a!textField(
    label: "Published On KLS",
    value: local!selectedEvent.PublishedOnKls,
    readOnly: true
    )
    }
    )
    }
    ),
    a!buttonArrayLayout(
    buttons: {
    a!buttonWidget(
    label: "Cancel",
    saveInto: {},
    style: "DESTRUCTIVE"
    ),
    a!buttonWidgetSubmit(
    label: "Update",
    saveInto: rule!UpdateEvent(
    ri!Event,
    fv!result,
    fv!error
    ),
    style: "PRIMARY"
    )
    },
    align: "START"
    )
    },
    showWhen: not(
    isnull(
    local!selectedEventId
    )
    )
    )
    )
Reply
  • Hi Anusha,

    Why are we defining local variable local!selectedEvent in with as local!selectedEventId is not updating in whole code and if it is is changing basis of any variable than we can define this on that component like

    a!save(
    ri!selectedEvent,rule!GetEventByIdExpressionRule(local!selectedEventId)
    )


    you can refer this code

    load(
    /*Replace with your rule to get the employee details */
    local!selectedEvent: rule!GetEventByIdExpressionRule(local!selectedEventId),
    a!sectionLayout(
    label: "Event Details for Event: ",
    contents: {
    a!columnsLayout(
    columns: {
    a!columnLayout(
    contents: {
    a!integerField(
    label: "Id",
    value: local!selectedEvent.Id,
    saveInto:
    {a!save(ri!Event.Id, save!value),
    a!save(ri!selectedEvent,rule!GetEventByIdExpressionRule(local!selectedEventId))
    },
    readOnly: true
    ),
    a!textField(
    label: "Team",
    value: local!selectedEvent.Team,
    readOnly: true
    )
    }
    ),
    a!columnLayout(
    contents: {
    a!textField(
    label: "Requested Date",
    value: local!selectedEvent.RequestedDate,
    readOnly: true
    ),
    a!dropdownField(
    label: "Status",
    labelPosition: "ABOVE",
    placeholderLabel: "--- Select a Value ---",
    choiceLabels: local!statusTypes.Status,
    choiceValues: local!statusTypes.Status,
    value: ri!Event.Status,
    saveInto: a!save(ri!Event.Status, save!value)
    )
    }
    ),
    a!columnLayout(
    contents: {
    a!textField(
    label: "Sent For Publishing",
    value: local!selectedEvent.SentForPublishing,
    readOnly: true
    ),
    a!textField(
    label: "Published On KLS",
    value: local!selectedEvent.PublishedOnKls,
    readOnly: true
    )
    }
    )
    }
    ),
    a!buttonArrayLayout(
    buttons: {
    a!buttonWidget(
    label: "Cancel",
    saveInto: {},
    style: "DESTRUCTIVE"
    ),
    a!buttonWidgetSubmit(
    label: "Update",
    saveInto: rule!UpdateEvent(
    ri!Event,
    fv!result,
    fv!error
    ),
    style: "PRIMARY"
    )
    },
    align: "START"
    )
    },
    showWhen: not(
    isnull(
    local!selectedEventId
    )
    )
    )
    )
Children
No Data