• highgosh
  • NEWBIE
  • 25 Points
  • Member since 2013

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

Using Apex in a trigger, how can one find the current SFDC instance (the pod - like "cs3") when in a sandbox logged in under a My Domain?  Using Url.getSalesforceBaseUrl().getHost(); doesn't seem to get us there.

Is it possible to fire a trigger upon the installation or update of a managed package?

We have two custom objects, both of which have the exact same custom fields in them; however, admins will be able to make additional custom fields within these objects, so we won't know the names of the fields themselves in advance.  So, we describe the origination object, grab all the fields, and do a query to find the records we want to create and add them to a List.

 

That works just fine.  Now, however, we want to insert these found records into the destination object.  For now, we can make the assumption that through business rules, the admin knows that both the origination object and the destination object must have the same field names with the same field types...essentially, identical fields.

 

How can I take the results in my origination object query and insert them into the destination object?

Using Apex in a trigger, how can one find the current SFDC instance (the pod - like "cs3") when in a sandbox logged in under a My Domain?  Using Url.getSalesforceBaseUrl().getHost(); doesn't seem to get us there.

We have two custom objects, both of which have the exact same custom fields in them; however, admins will be able to make additional custom fields within these objects, so we won't know the names of the fields themselves in advance.  So, we describe the origination object, grab all the fields, and do a query to find the records we want to create and add them to a List.

 

That works just fine.  Now, however, we want to insert these found records into the destination object.  For now, we can make the assumption that through business rules, the admin knows that both the origination object and the destination object must have the same field names with the same field types...essentially, identical fields.

 

How can I take the results in my origination object query and insert them into the destination object?