function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Akash ParasharAkash Parashar 

I need to pass dynamically current user account custom field in below javascript, in values: ["8888"] section, is there any way i can do that?



const filter1= { $schema: "http:/000000",
target: {
table: "VW_SF_VIS_ORG", column: "RETAILER_CD" },
operator: "In",
values: ["88888"]
}
Best Answer chosen by Akash Parashar
Salesforce DeveloperSalesforce Developer
Try as below: 
<script type="text/javascript">
       function showUserDetails(){
           alert('Custom Field value on User: {!$user.custom__c}');
       }
       showUserDetails();
</script>

Your Code: 

const filter1= { $schema: "http:/000000",
target: {
table: "VW_SF_VIS_ORG", column: "RETAILER_CD" },
operator: "In",
values: ["{!$user.custom__c}"]
}

All Answers

sunny.sfdcsunny.sfdc
I believe you need to quey user record to get custom fields using JSRemoting etc. Only few standard fields are available through api.

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_js_remoting_example.htm
Salesforce DeveloperSalesforce Developer
Try as below: 
<script type="text/javascript">
       function showUserDetails(){
           alert('Custom Field value on User: {!$user.custom__c}');
       }
       showUserDetails();
</script>

Your Code: 

const filter1= { $schema: "http:/000000",
target: {
table: "VW_SF_VIS_ORG", column: "RETAILER_CD" },
operator: "In",
values: ["{!$user.custom__c}"]
}
This was selected as the best answer