I have tried to Create a custom Detail in my Custom Section but not able to bind it with "Id" of the Parent Object as in Classic ui When we Create Detail it Automatically fetch the Current Record if and we are able to see the list in detail for current record. Can anyone help how to do the same in Freedom UI
In the new interface, the details are configured similarly to the mechanism used in the old interface. It also includes automatic mapping to the ID of the current record, so there is no need to add it separately. For example, in the "Orders" detail added to the "Account" section by default, we can see that the detail displays records where Account.Id (of the current record) is equal to Order.AccountId.
As for now, you could do the following - in this example I have a lookup for ContactType and will retrieve the Description once selected. You'll ned to know the actual attribute name for the lookup which you can see in the viewDiffConfig for the control as:
control: "$SomeAttributeName" (this is the attribute name, minus the "$")
Then, add a change request handler like this:
{
request:"crt.HandleViewModelAttributeChangeRequest",
handler: async (request, next)=>{// listen for changes to the Lookup field attributeif(request.attributeName==="LookupAttribute_spr6dlv"&&!request.silent){// get the selected value
var lookupVal = await request.$context.LookupAttribute_spr6dlv;// retrieve the descriptionconst model = await sdk.Model.create("ContactType");const results = await model.load({
attributes:["Description"],
parameters:[{
type: sdk.ModelParameterType.PrimaryColumnValue,
value: lookupVal.value}]});const desc = results[0].Description;// set the other column's attribute with the description
request.$context.SomeOtherAttribute= desc;}return next?.handle(request);}}
value: "38ea507c-55e6-df11-971b-001d60e938c6" - Id here can be dynamically set as some variable that is received from the context. To set the result for the column (in this case for the UsrSubjectDetails):
As for now, you could do the following - in this example I have a lookup for ContactType and will retrieve the Description once selected. You'll ned to know the actual attribute name for the lookup which you can see in the viewDiffConfig for the control as:
control: "$SomeAttributeName" (this is the attribute name, minus the "$")
Then, add a change request handler like this:
{
request:"crt.HandleViewModelAttributeChangeRequest",
handler: async (request, next)=>{// listen for changes to the Lookup field attributeif(request.attributeName==="LookupAttribute_spr6dlv"&&!request.silent){// get the selected value
var lookupVal = await request.$context.LookupAttribute_spr6dlv;// retrieve the descriptionconst model = await sdk.Model.create("ContactType");const results = await model.load({
attributes:["Description"],
parameters:[{
type: sdk.ModelParameterType.PrimaryColumnValue,
value: lookupVal.value}]});const desc = results[0].Description;// set the other column's attribute with the description
request.$context.SomeOtherAttribute= desc;}return next?.handle(request);}}
I have a requirement where "A" is a date field and "B" is a boolean. When a record is created, it should calculate the number of days left until "A" arrives. If the number of days left is less than 45, then the value of "B" should be changed to "true".
Note : I m using Freedom UI. Also if this is possible through Bussiness Process please Advise.
If you are referring to the way the data is represented, it depends on the type of the column (in order to make the value not have zero after it - make the column integer)
If you want to show a checkbox that would be ticked if a certain number is reached and you do not want to use code, keep the column in which you store the number of days, and on the base of it, build a business rule that "if the number of days is reached, then make the box true"