• Leonardo Brozinga Viglino
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Hello All,

I'm currently developing a component to use in a quick action in a record page of a Custom object I created.
My component will use Lightning data service to create records of two different custom objects.
I will call one object Main__c, and the other one Smaller__c, Smaller__c is a child of Main__c and has a lookup relationship to it.
My component is composed by one Main component, which houses other Smaller components.
Inside my Main component, I use iteration to create a list of another Smaller components, in which each one have input fields to user input and a file upload element.
Also in my Main component, I have a save button which will execute LDS(Lightning Data services) saveRecord in both Main and Smaller Components.
Whenver the user fills up the entire Smaller components list fields, he clicks the Save button. This executes saveRecord in my force:recordData located in my Main component, creating a Main__c object.
Using saveResult.state, I check what the result was, if it is 'SUCCESS' or 'DRAFT', I fire an event which will be handled by each Smaller components. This event carries the recently created Main__c ID using lightning event attributes and saveResult.recordId to get the Main__c ID.
Each Smaller component has a handler to the event generated by Main component, whenever it gets fired it will execute its force:recordData.saveRecord in order to its corresponding Smaller__c object , with the user typed in info, and uses the event parameter to get the Main__c Id to populate the Smaller__c lookup relationship fild to Main__c. Note: the Main component contains several Smaller components, and the event will be listened by each one of the Smaller component, therefore creating one Smaller__c for each.

This works perfectly when I'm testing in desktop, the problem is I need this to work in mobile app.

When I try it at mobile app, my Main__c creation saveResult always return with 'DRAFT', and its saveResult.RecordId is something weird as "a05___qkEjrVUV9AIO", yes it has 3 underscores in it '___'.
So, when the event is fired, Smaller__c creation fails because the parent Main__c wasn't succesfully created, because it is in 'DRAFT', and I'm sure he can't find "a05___qkEjrVUV9AIO" as a valid Id.

Of course, I can just not fire the event when the saveResult is 'DRAFT', but if I do so, then my Main__c object with 'DRAFT' state will eventually be created outside my lightning component runtime, but my child Smaller__c objects will never be created.

A possible solution that came to me, would be an apex trigger after Main__c is insert object that would fire the events in Smaller components. But I'm not sure it's possible to fire lighting events inside Apex Triggers.

My component works perfectly in desktop, how can I address this issue for mobile, when my parent object is in 'DRAFT' state?

 
Hello All,

I'm currently developing a component to use in a quick action in a record page of a Custom object I created.
My component will use Lightning data service to create records of two different custom objects.
I will call one object Main__c, and the other one Smaller__c, Smaller__c is a child of Main__c and has a lookup relationship to it.
My component is composed by one Main component, which houses other Smaller components.
Inside my Main component, I use iteration to create a list of another Smaller components, in which each one have input fields to user input and a file upload element.
Also in my Main component, I have a save button which will execute LDS(Lightning Data services) saveRecord in both Main and Smaller Components.
Whenver the user fills up the entire Smaller components list fields, he clicks the Save button. This executes saveRecord in my force:recordData located in my Main component, creating a Main__c object.
Using saveResult.state, I check what the result was, if it is 'SUCCESS' or 'DRAFT', I fire an event which will be handled by each Smaller components. This event carries the recently created Main__c ID using lightning event attributes and saveResult.recordId to get the Main__c ID.
Each Smaller component has a handler to the event generated by Main component, whenever it gets fired it will execute its force:recordData.saveRecord in order to its corresponding Smaller__c object , with the user typed in info, and uses the event parameter to get the Main__c Id to populate the Smaller__c lookup relationship fild to Main__c. Note: the Main component contains several Smaller components, and the event will be listened by each one of the Smaller component, therefore creating one Smaller__c for each.

This works perfectly when I'm testing in desktop, the problem is I need this to work in mobile app.

When I try it at mobile app, my Main__c creation saveResult always return with 'DRAFT', and its saveResult.RecordId is something weird as "a05___qkEjrVUV9AIO", yes it has 3 underscores in it '___'.
So, when the event is fired, Smaller__c creation fails because the parent Main__c wasn't succesfully created, because it is in 'DRAFT', and I'm sure he can't find "a05___qkEjrVUV9AIO" as a valid Id.

Of course, I can just not fire the event when the saveResult is 'DRAFT', but if I do so, then my Main__c object with 'DRAFT' state will eventually be created outside my lightning component runtime, but my child Smaller__c objects will never be created.

A possible solution that came to me, would be an apex trigger after Main__c is insert object that would fire the events in Smaller components. But I'm not sure it's possible to fire lighting events inside Apex Triggers.

My component works perfectly in desktop, how can I address this issue for mobile, when my parent object is in 'DRAFT' state?

 
Cannot get the custom console component to display when following directions in the unit Configure a Salesforce Console. A few of us are trying to do this and it doesn´t display. We have followed step and saved and refreshed but it just doesn´t show up in left margin. What setting are we missing?

Custom Console Component config in SetupSample Console not showing change
Was wondering if anyone is have a problem displaying the map from leaflet onto a lighting component record page. Following the Accounts near me trailhead. In the trailhead you can see the map in the App which is fine. But i am not able to show it in a lighting component.