GM - Flow Edit Grid
(gmpkg:FlowEditGridComponent)
Documentation
GM - Flow Edit Grid component is used to edit records from a data grid inside a flow.
Use case: Display a grid of contacts to add them as opportunity contact roles in a screen flow. See Flow Tutorial.
Specification
The following properties use JSON syntax as part of their configuration: .
API Reference
<design:component label="GM - Flow Edit Grid">
<design:attribute name="recordId" label="01. recordId"
description="recordId to use. Keep this empty if you want to use the current record"/>
<design:attribute name="relatedObjectName" label="02. Related Object Name"
description="The name of the related object to display. Ex. Opportunity"/>
<design:attribute name="fieldSetName" label="03. FieldSet Name"
description="The fieldSet name of the related object to display"/>
<design:attribute name="rowLimit" label="04. Row Limit"
description="The maximum number of row to fetch"/>
<design:attribute name="customLabel" label="05. Custom Label"
description="Override the label of data grid"/>
<design:attribute name="customIcon" label="06. Custom Icon"
description="Customize the data grid icon. All lightning icons are supported. You can get the icon name from https://lightningdesignsystem.com/icons/"/>
<design:attribute name="height" label="07. Grid Height"
description="Set the grid height"/>
<design:attribute name="columnStyles" label="08. Column Style"
description="Json string to define column's style. Donβt forget __c for custom fields. Ex. {'StageName':'width:200px'} to set the width for Stage column"/>
<design:attribute name="candidates" label="09. Candidates"
description="The list of candidates to display"/>
<design:attribute name="filter" label="10. Filter"
description="Json string to define filter criteria. Donβt forget __c for custom fields. Ex. {'StageName':'Needs Analysis'} to see only 'Needs Analysis' Opportunities"/>
<design:attribute name="sort" label="11. Sort"
description="The field list to sort the data grid. This field is used only for the initial load. Donβt forget __c for custom fields. Ex. Amount to sort opportunities by amount"/>
<design:attribute name="order" label="12. Order"
description="Asc or Desc order for sorting"/>
<design:attribute name="showBorder" label="13. Show Border"
description="Show Border"/>
<design:attribute name="showColumnBorder" label="14. Show Column Border"
description="Show Column Border"/>
<design:attribute name="fieldLabels" label="15. Custom Field Labels"
description="{name:label} custom field labels map"/>
<design:attribute name="coloring" label="16. Cell Coloring"
description="JSON conditions for cells coloring"/>
<design:attribute name="lookupOptions" label="17. Lookup Fields Options"
description="JSON options for lookup fields {apiName : {titleField : value, subTitleField : value}}"/>
<design:attribute name="defaultValues" label="18. Default Values"
description="Json string to initialize a new object created from the data grid. Donβt forget __c for custom fields. Ex. {'accountid':'$recordId', 'name':'Opp 1', 'stagename':'Needs Analysis'}"/>
<design:attribute name="canUpdate" label="19. Enable Update Object"
description="Check this option if you want to update object"/>
<design:attribute name="canDelete" label="20. Enable Delete Object"
description="Check this option if you want to delete object"/>
<design:attribute name="canCreate" label="21. Enable Create Object"
description="Check this option if you want to create object"/>
<design:attribute name="saveOnNext" label="22. Save Records"
description="Check this option if you want to save the record on next"/>
<design:attribute name="updatedJsonRecords" label="23. Updated Records"
description="The list of updated records as JSON string. It includes created and modified records"/>
<design:attribute name="deletedJsonRecords" label="24. Deleted Records"
description="The list of deleted records as JSON string"/>
<design:attribute name="createdJsonRecords" label="25. Created Records"
description="The list of new records as JSON string. It contains only created records"/>
<design:attribute name="modifiedJsonRecords" label="26. Modified Records"
description="The list of modified records as JSON string. It contains only modified records"/>
<design:attribute name="cellHandlerDef" label="27. Cell Change Handler"
description="Cell Change Handler Component"/>
</design:component>
Cell Handler Example
<aura:component controller="CellHandlerController" access="global">
<aura:method name="handleCellChange" action="{!c.handleCellChange}" access="global">
<aura:attribute name="component" type="Object" />
<aura:attribute name="params" type="Object" />
</aura:method>
</aura:component>
({
handleCellChange: function (component, event, helper) {
let args = event.getParam('arguments');
let item = args.params.item;
let column = args.params.column;
let value = args.params.value;
let parentComponent = args.component;
if (column.name === 'Product2Id') {
if (value) {
let action = component.get('c.getListPrice');
action.setParams({
oppId: item.OpportunityId,
prodId: value
});
action.setCallback(this, function (res) {
if (res.getState() === 'SUCCESS') {
let listPrice = res.getReturnValue();
parentComponent.setCellValue(
item.UID,
'ListPrice',
listPrice
);
} else if (res.getState() === 'ERROR') {
console.error(res.getError());
}
});
$A.enqueueAction(action);
} else {
parentComponent.setCellValue(item.UID, 'ListPrice', 0);
}
}
}
});
public with sharing class CellHandlerController {
@AuraEnabled
static public Decimal getListPrice(String oppId, String prodId) {
Opportunity opp = [
SELECT Id, Pricebook2Id
FROM Opportunity
WHERE Id = :oppId
];
PricebookEntry pbe = [
SELECT Id, UnitPrice
FROM PricebookEntry
WHERE Pricebook2Id = :opp.Pricebook2Id AND Product2Id = :prodId
];
return pbe.UnitPrice;
}
}
Last updated