• Ferdy Reyes 3
  • NEWBIE
  • 20 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 1
    Replies

I need to be able to dynamically get how many hours in a day of BusinessHours record. I need to be able to do it dynamically. How do I do it?
This is sample code of what I am doing:
 

Map<String,BusinessHours>bhMap = new Map<String,BusinessHours>();
...
decimal result = BusinessHours.diff(bhMap.get(key).Id,DateTime1,DateTime2);
decimal numOfDay = result / (1000*60*60* x);
//where x should be the num of hours per business day based on Businesshours
Is it possible?
I am wondering which is created first,. In current project I am supporting, the is a Process Builder which is ran when EmailMessage record is either created or updated. This PB then updates the Case record related to the  triggering EmailMessage record. Does this mean the Case record is already created before the EmailMessage record is created?
I need to update around 500 records of custom metadata type records. I know I can mass insert using VSCode and Salesforce CLI. Can I also do an update if I have CSV of the records with their respective IDs?
We have a validation rule where a Contact whose custom field does not match matching custom field in Case Contact and Account will be not be linked in Case. For some reason, regardless of the validation rule, Email-To-Case links the Contact and corresponding Person Account to Case as long at it matches SuppliedEmail.

Is there a way to filter the Contact when the Case is created by Email-To-Case? Declarative solution or trigger is welcome.
I created a lightning:datatable with static row actions following documentation but for some reason, the actions don't fire. Any idea why?

Below are my code:

datatable:
<lightning:datatable columns="{!v.columns}" data="{!v.data}" keyField="Id" hideCheckboxColumn="true" onRowAction="{!c.handleRowAction}" />

columns:
var actions = [
    {label:'Edit',name:'edit'},
    {label:'Delete',name:'delete'},
    {label:'Close Task',name:'close_task'}
];
cmp.set('v.columns',[
    {label:'Subject', fieldName:'linkName', type:'url',
     typeAttributes:{label:{fieldName:'Subject'}},
     target:'_blank'
    },
    {label:'Status',fieldName:'Status',type:'picklist'},
    {type:'action',typeAttributes:{rowActions:actions}}
]);

handleRowAction:
handleRowAction : function(cmp,evt,hlpr) {
    var action = evt.getParam('action');
    var row = evt.getParam('row');
    switch(action.name) {
        case 'edit':
            alert('edit');
            break;
        case 'delete' :
            console.log('delete '+row.Id);
            break;
        case 'close_task' :
            alert('close '+row.Id);
            break;
    }

}

​​​​​​​​​​​​​​
I need to update around 500 records of custom metadata type records. I know I can mass insert using VSCode and Salesforce CLI. Can I also do an update if I have CSV of the records with their respective IDs?