You need to sign in to do that
Don't have an account?
Lalitha Pavani Rallabandi 9
I want to bold the record name using the <lightning:outputField> and I am not using any apex class or something other since we are using LDS (Lightning Data Services). Here is my code. Please help me out to make the Record Name bold
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" > <aura:attribute name="recordId" type="ID"/> <aura:attribute name="lead" type="Lead"/> <lightning:recordViewForm recordId="{!v.recordId}" objectApiName="Lead" density="comfy" > <lightning:card iconName="standard:lead"> <aura:set attribute="title"> Lead<br></br> <div style="font-weight: bold;"> <lightning:outputField fieldName="Name" variant="label-hidden" /> </div> </aura:set> <lightning:layout> <lightning:layoutItem padding="around-small" size="2"> <lightning:outputField fieldName="AnnualRevenue"/> </lightning:layoutItem> <lightning:layoutItem padding="around-small" size="2"> <lightning:outputField fieldName="Email"/> </lightning:layoutItem> <lightning:layoutItem padding="around-small" size="2"> <lightning:outputField fieldName="Fax"/> </lightning:layoutItem> <lightning:layoutItem padding="around-small" size="2"> <lightning:outputField fieldName="Industry"/> </lightning:layoutItem> <lightning:layoutItem padding="around-small" size="2"> <lightning:outputField fieldName="LeadSource"/> </lightning:layoutItem> <lightning:layoutItem padding="around-small" size="2"> <lightning:outputField fieldName="Status"/> </lightning:layoutItem> </lightning:layout> </lightning:card> </lightning:recordViewForm> </aura:component>
lightning:recordViewForm doesn't have the onload method use lightning:recordEditForm if you still want to use outputField component to display field value. In this case you can extract the Name field to a variable and display it without using outputField as the formating issue comes from this component.
Another solution might be to use the "class" attribute of the outputField to style it. It should allow you to give the proper style.
Otherwise your solution is obviously working and is a good option. It just require a little bit more code and is more custom. Sometimes Salesforce force us to go that way, it's sad but it's a lot easier to make our own workarounds that to wait for them to fix anything. Especially if you work with aura components which are deprecated in favour of LWC. Switching to LWC is also a really good option here. I started working with LWC a while ago and find it easier to customize. Depending on what you need to achieve, I will first try to go with LWC and if not possible then use Aura.
Best regards,
Barthélemy
All Answers
Can you have a look at the below link:
>> https://developer.salesforce.com/forums/?id=9062I000000XpanQAC
In case if this helps can you please choose this as best answer so that it can be used by others in the future.
Regards,
Anutej
If this answer helps you, please mark it as accepted.
Regards,
Tushar Sharma
https://newstechnologystuff.com/
In your case, the outputField component probably override the css you try to apply.
Just a small advice here.
Salesforce has made SLDS system with UX designer. They give a lot of guidelines about how we should display things. Not following what they advice is always an option and not the recommended one. That being said, users always have weird request, it is also our job to educate them that some requests doesn't make sense in the context they are working and that other solutions can be found sometimes.
End of the advice.
For me you can investigate three different options :
Hi @Barthelemy Laurans 1, Sorry didn't work.
I am doing the same using "force record data" form. It is working. I tried the same with record view form, but no use. I don't understand the exact issuw with record view form.
Here is the code with force record data with minor changes in displaying the fields.
And the resulted output is::
lightning:recordViewForm doesn't have the onload method use lightning:recordEditForm if you still want to use outputField component to display field value. In this case you can extract the Name field to a variable and display it without using outputField as the formating issue comes from this component.
Another solution might be to use the "class" attribute of the outputField to style it. It should allow you to give the proper style.
Otherwise your solution is obviously working and is a good option. It just require a little bit more code and is more custom. Sometimes Salesforce force us to go that way, it's sad but it's a lot easier to make our own workarounds that to wait for them to fix anything. Especially if you work with aura components which are deprecated in favour of LWC. Switching to LWC is also a really good option here. I started working with LWC a while ago and find it easier to customize. Depending on what you need to achieve, I will first try to go with LWC and if not possible then use Aura.
Best regards,
Barthélemy
we can do by wrapping in class
<div class="boldClass">
<lightning-output-field field-name={field1} field-class="boldClass"> </lightning-output-field>
</div>
in css :
.boldClass{
--lwc-inputStaticFontWeight: bold !important;
}