• Kent Lichty 11
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
I am writing a simple LWC page using SLDS grid with lightning-output-fields and is uses a lot of numeric fields, which I want to right justify within the grid cell.  I use this technique to right align the numeric variables within the grid like this, which works fine:

<div class="slds-col--padded slds-size_1-of-6">
                <lightning-output-field  field-name="Team_Sales_Quarter4__c" variant="label-hidden" style="float:right">
                </lightning-output-field>
 </div>

However, I am using hardcoded text as my column headings, and I cannot figure out a good way how to right align those column headings so that they line up nicely with the numbers underneath them. The only way I can do this is to use a LOT of &nbsp tags, which I know is horribly bad form, and it looks like this:

<div class="slds-col--padded slds-size_1-of-6">              <b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Quarterly Sales</b>
</div>

I know that there are "align" tags in the SLDS grid system, but those tags seem to apply to the alignment of the grids themselves, and NOT the contents within those grids.

I think that there MUST be a better way to handle this (probably using CSS, which I don't know well), so I would really appreciate any advice that could be offered.

Thanks very much.
My organization is in the process of implementing Salesforce as its ERP, just as I am in the process of learning Force.com programming.  I have been asked to develop a solution which I am just not sure is possible and, if it is, then it will require programming skills in LWC development that are currently beyond me.  So I would be very grateful if anyone in this forum could offer some assistance.

The root of the problem is that, when custom objects were developed, it was not understood that Salesforce works much better when custom objects are designed in a “denormalized” manner, where a single “long” record would contain many fields.  We were still thinking in “normalized” SQL terms, where narrower objects were created, linked by keys.  Here is a simple, if not realistic, example of what I am attempting to describe:

We have a custom “Product Price” object which contains these three fields:

Product, Currency Code, Price. 

So three records would look like this:
PRODUCT 1         USD       25.00
PRODUCT1          EUR        28.00
PRODUCT1          GBP       29.50

However, while the records are STORED in the above manner, it is realized that it is difficult and cumbersome to display/maintain the records using standard Salesforce functionality, so I have been asked to come up with a UI that would make it easier to enter/change the prices for each product, which would look something like this, in a datatable where the prices would be EDITABLE:

PRODUCT ID       USD PRICE           EUR PRICE           GBP PRICE                          
PRODUCT1          25.00                      28.00                     29.50
PRODUCT2          50.00                      54.00                     _____
PRODUCT3          75.00                       _____                   80.00

I am able to easily define and display a class wrapper which contains the information that I want to DISPLAY; that is no problem.  The issue with which I am struggling is the UPDATE part, especially given the fact that I have no valid record ID because in this case, THREE record IDs would be involved, one for each record in the Product Price object.  If I can get the list back to Apex (preferably only MODIFIED records in the list) back to Apex, then I would be good to go.  But that is the part that I am not understanding: how to get my modified datatable records back to Apex so I can process them.

I am guessing that what I want to do IS POSSIBLE, by doing something like this, but the exact details are not apparent to me:

1:  Add a button (Save/Update) that would call my Apex program imperatively, passing the list back to it. The button would fire a Javascript function which would do the following.

2:  Using the concept of draft values, the function would read the list and only pass back to Apex the records which had been modified.  But I have no clue how to do that.  I assume this would require sending back either JSON or a map <String, Object> back to my Apex controller. This is the critical part that I am not understanding.

3:  Once I get the list records back to Apex, I think I can handle the update part.  I would probably send the 3 record IDs of the Product Price as part of my class wrapper so I could use them to get a handle on any records that I need to update.

So that is my problem.  I am hoping that some other people have had the same issue and have been able to come up with a solution which currently eludes me.  If anybody could just tell me in general the techniques that I could use to implement my goal, I can do the research and figure out the details.  Also, if any could point me to any sites which describe a similar problem and solution, I would be exceedingly grateful.                
 
My organization is in the process of implementing Salesforce as its ERP, just as I am in the process of learning Force.com programming.  I have been asked to develop a solution which I am just not sure is possible and, if it is, then it will require programming skills in LWC development that are currently beyond me.  So I would be very grateful if anyone in this forum could offer some assistance.

The root of the problem is that, when custom objects were developed, it was not understood that Salesforce works much better when custom objects are designed in a “denormalized” manner, where a single “long” record would contain many fields.  We were still thinking in “normalized” SQL terms, where narrower objects were created, linked by keys.  Here is a simple, if not realistic, example of what I am attempting to describe:

We have a custom “Product Price” object which contains these three fields:

Product, Currency Code, Price. 

So three records would look like this:
PRODUCT 1         USD       25.00
PRODUCT1          EUR        28.00
PRODUCT1          GBP       29.50

However, while the records are STORED in the above manner, it is realized that it is difficult and cumbersome to display/maintain the records using standard Salesforce functionality, so I have been asked to come up with a UI that would make it easier to enter/change the prices for each product, which would look something like this, in a datatable where the prices would be EDITABLE:

PRODUCT ID       USD PRICE           EUR PRICE           GBP PRICE                          
PRODUCT1          25.00                      28.00                     29.50
PRODUCT2          50.00                      54.00                     _____
PRODUCT3          75.00                       _____                   80.00

I am able to easily define and display a class wrapper which contains the information that I want to DISPLAY; that is no problem.  The issue with which I am struggling is the UPDATE part, especially given the fact that I have no valid record ID because in this case, THREE record IDs would be involved, one for each record in the Product Price object.  If I can get the list back to Apex (preferably only MODIFIED records in the list) back to Apex, then I would be good to go.  But that is the part that I am not understanding: how to get my modified datatable records back to Apex so I can process them.

I am guessing that what I want to do IS POSSIBLE, by doing something like this, but the exact details are not apparent to me:

1:  Add a button (Save/Update) that would call my Apex program imperatively, passing the list back to it. The button would fire a Javascript function which would do the following.

2:  Using the concept of draft values, the function would read the list and only pass back to Apex the records which had been modified.  But I have no clue how to do that.  I assume this would require sending back either JSON or a map <String, Object> back to my Apex controller. This is the critical part that I am not understanding.

3:  Once I get the list records back to Apex, I think I can handle the update part.  I would probably send the 3 record IDs of the Product Price as part of my class wrapper so I could use them to get a handle on any records that I need to update.

So that is my problem.  I am hoping that some other people have had the same issue and have been able to come up with a solution which currently eludes me.  If anybody could just tell me in general the techniques that I could use to implement my goal, I can do the research and figure out the details.  Also, if any could point me to any sites which describe a similar problem and solution, I would be exceedingly grateful.