You need to sign in to do that
Don't have an account?
how can i access the fields from an Sobject with map?
Hello,
I have a small trigger:
trigger SetTitleToAttachment on Attachment (after insert) { //store the ID of the new attachment ID attachment; ID workOrder; for (Attachment att : Trigger.new) { attachment = att.ID; workOrder = att.ParentId; } Map<ID, SVMXC__Service_Order__c> wo =new Map<ID, SVMXC__Service_Order__c>( [SELECT ID, NAME, SVMX_PS_Ship_To_Name__c from SVMXC__Service_Order__c WHERE ID =: workOrder ]); }
My question is: how can I access the fieds: Name and SVMX_PS_Ship_To_Name__c from this map?
I'm confused.
All Answers
Hi Agustin,
But if I want to make a new variable called woName and I want to assign the value from the map should be something like this?:
If it does please like an choose best answer to get the question closed.
Good luck
Is there any workaround on this? :(
I had to put before insert. :)
Done :)
Thanks a lot!
You could try something like this: Also consider this trigger you wrote is not prepare for inserting several Attachments with different parentId at the same time you would have to write something a little more complex for that.
If your question is solved please mark as best, if you need to make it bulk you could open a new question and I will try to provide you with the code there.
Good luck
Hi Agustin,
I have this error.
this field CheckerSFM exists in my object...