4

I am looking for a solution to a basic scenario:

A User in a Community submits an Opportunity, this Opportunity is enriched with data synchronously upon insert and asynchronously through integrations upon updates. An LWC is used to present the Opportunity to the User whom can take actions on this, update fields etc.

In a specific scenario the StageName will go from X -> Y based on response from a Platform Event integration (Async). In our ideal scenario the LWC would then auto-refresh its data and the field Stage Name would show Y.

Since it is in the Communities we cannot use the EMP Api and it appears that if you utilize the Record Edit Form it doesn't detect changes from Lightning Experience UI nor when the change occurs from an API or process update (towards the Communities), the same component updates correctly once added in Lightning Experience, but not in Communities.

Currently I have an ugly refresh javascript action with timeout that uses refreshApex, I am OK with using the refreshApex method, if I can just make sure that I know when to call it (when there is an actual change on the record).

If there is not a "real" solution for this until EMP Api is available in Communities, how are these use cases handled then (not necessarily best practice but more in theory)?

Basic example of the code used:

<lightning-record-edit-form record-id={recordId} object-api-name="Opportunity">
        <lightning-input-field field-name="Name">
        </lightning-input-field>
        <lightning-input-field field-name="StageName">
        </lightning-input-field>
        <lightning-button
            class="slds-m-top_small"
            variant="brand"
            type="submit"
            name="update"
            label="Update">
        </lightning-button>
    </lightning-record-edit-form>
2
  • 1
    You can use cometD in communities as specified by Mohith ? salesforce.stackexchange.com/questions/289584/… Commented Feb 9, 2020 at 14:28
  • Thanks Pranay, I do not know how I missed that post in my search for this. And so obvious to just build your own EmpApi component with the standard cometD library.. Works great!
    – erikduvet
    Commented Feb 10, 2020 at 15:13

0

You must log in to answer this question.

Browse other questions tagged .