Display field with complex info in html format (rich text editor)
Display field with complex info in html format (rich text editor)
First step: Display through html
fields: [{
field: 'display rights',
type: 'String',
get: (account) => {
//check if the movie has a related characteristics record to return smtg or not
if (account.right) {
// list all your fields from the movie_characteristics collection you want to display
const rightsNameList = ["feature1", "feature2"];
// create empty string which will be filled with a div per field listed above - this string will be the value returned
let rightsList = ""
// add style that will be used to display the movie_characteristics info
const rightsDivStyle = 'margin: 24px 0px; color: #415574'
const rightsNameStyle = 'padding: 6px 16px; margin: 12px; background-color:#b5c8d05e; border-radius: 6px'
const rightsValueStyleRed = 'padding: 6px 12px; background-color:#ff7f7f87; border-radius: 6px'
const rightsValueStyleGreen = 'padding: 6px 12px; background-color:#7FFF7F; border-radius: 6px'
// iterate over the list of movie characteristics fields
for (index = 0; index < rightsNameList.length; index++) {
const fieldName = rightsNameList[index]
let rightsValueStyle = rightsValueStyleRed
if (account.right[fieldName] === true) {
rightsValueStyle = rightsValueStyleGreen
}
// insert the div with the field info to the string that will be returned
rightsList += `<div style="${rightsDivStyle}">
<span style="${rightsNameStyle}">${fieldName}</span>
<span style="${rightsValueStyle}">${account.right[fieldName]}</span>
</div>`
}
return rightsList
}
}
}],Second step: Update through a smart action
PreviousAdd an HTML credit card as a smart field in a summary viewNextGenerate signed urls to display S3 files in a smart field
Last updated
Was this helpful?