• Jheel D. Agrawal
  • NEWBIE
  • 5 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
Hi everybody,
i'm tryng to udate a relationship from an opportunity and a cutom object inside a trigger using an external id to link each other.
if I use a code like this it works and the relation is created corretly, but using it ina before trigger (so without the dml) it doesn't work. 
opportunity op = [select id, relatedobj__c from opportunity where id='xxxxxxxxxxx'];
relatedobj__c aa =new relatedobj__c ( iEXTERNALID__c='34567');
op.Pincoobjectidest__r=aa;
database.SaveResult res=database.update(op);
Do anybody can explain me why? 
thank you
I'm trying to deploy a build that includes a fieldsets.  In the package document I have tried to retrieve using:
 
<types>
        <members>MyFieldset</members> 
        <name>Fieldset</name>
</types>
and
<types>
        <members>Account.MyFieldset</members> 
        <name>Fieldset</name>
</types>
and
<types>
        <members>Account.fieldset.MyFieldset</members> 
        <name>Fieldset</name>
</types>

The rest of the package retrieve and deploys fine but when I include the code for fieldset I get this error:

Entity type: 'Fieldset' is unknown

Are fieldsets not deployable via ANT?  If that's the case, it should be documented somewhere.
I have a package that contains apex code using a named credential to access an external REST service. The code works fine in the dev org, but once packaged and deployed to a test (subscriber) org I'm getting a System.CalloutException with the following message:
 
The callout couldn't access the endpoint. You might not have the required permissions, or the named credential "My_Named_Credential" might not exist.

The named credential is not included in the package as the endpoint configuration needs to be different for each org, however I've created the named credential in the test (subscriber) org, exactly as I have it in the dev org. The documentation on the use of named credentials in Apex code within packages suggests that this should work fine:

<excerpt>
If you package Apex code that specifies a named credential as a callout endpoint, also add the named credential to that package or otherwise make sure that the subscriber organization has a valid named credential with the same name.
</excerpt>

Ref: http://www.salesforce.com/us/developer/docs/packagingGuide/Content/packaging_component_behavior.htm

My Apex code:

            // Setup the REST call
            Http http = new Http();
            String endpointURL = 'callout:My_Named_Credential'; // Named Credential
    
            // Establish the request
            HttpRequest reqData = new HttpRequest();
            reqData.setTimeout(20000);
            reqData.setEndpoint(endpointURL);
            reqData.setMethod('POST');

            // Attempt the API callout
            HTTPResponse res = http.send(reqData);

Has anyone been able to successfully get this working? Are there any work-arounds I need to be aware of?

Thanks in advance,
BW.