• pbis
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Hi,

I have a custom object which stores Picklist Field API name,Object Name,picklist value to insert and the record type to which the picklist value get added.Then I have a scheduler class(Apex) which tries to update the picklist field and record type.But I'm facing problem as UpdateMetadata() call is asynchronous so I need to wait till the time the picklist field is updated,there after I can update the Record Type but I don't find any Sleep() type of method in apex.Also using a loop to wait does't seem to be a good Solution.

I also tried to achieve the same be updating the picklist as well as record type at a same time but It failed.

I am updating the salesforce metadata from within salesforce and cannot use visualforce for this.Using visualforce User would be require Modify All Data permission which canot be provided.

Please Help.


  • January 14, 2014
  • Like
  • 0

Hi,

 

I have a Trigger on Insert  which populates a field of Opportunity with Date.today().Time Zone of User and Company is CST.

In Test class assertion is written to check whether the field's value is Date.today() or not.

But the test class fails only for some time around 11:00 to 11:30 AM IST.

I have also put debug statement in test class and trigger to view the Date.today() and then I run the test class.But it shows wired behaviour .In test class Date.today() appears as date of the logged in user but in trigger around 11:00 to 11:25 AM IST  Date.today() is diplayed as the very next Day i.e. if it is 28 th Nov in CST then in trigger it displays 29 th Nov .The same test class works fine rest of the day.

 

Can someone help me.It creates issue since I cannot deploy changes to production in this time span.

  • November 29, 2013
  • Like
  • 0
Hi,

I have a custom object which stores Picklist Field API name,Object Name,picklist value to insert and the record type to which the picklist value get added.Then I have a scheduler class(Apex) which tries to update the picklist field and record type.But I'm facing problem as UpdateMetadata() call is asynchronous so I need to wait till the time the picklist field is updated,there after I can update the Record Type but I don't find any Sleep() type of method in apex.Also using a loop to wait does't seem to be a good Solution.

I also tried to achieve the same be updating the picklist as well as record type at a same time but It failed.

I am updating the salesforce metadata from within salesforce and cannot use visualforce for this.Using visualforce User would be require Modify All Data permission which canot be provided.

Please Help.


  • January 14, 2014
  • Like
  • 0