• Chembur
  • NEWBIE
  • 0 Points
  • Member since 2013

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

I have 'unlimited Edition' and API enable and running as system administrator.

I have a REST API wil endpoint 'http://mycompany.com/test. I have set this URL as Remote site setting

 

The code to execute REST is below.. When  I execute the code from ny sandbox I get 403 Forbidden error. Any help appreciated

 

HttpRequest request = new HttpRequest();
        HttpResponse response = new HttpResponse();
        Http http = new Http();
        
        JSONGenerator jsonGen = JSON.createGenerator(true);
        jsonGen.writeStartObject();
        jsonGen.writeStringfield('testString', '12345');
        jsonGen.writeEndObject();
        String jsonPro = jsonGen.getAsString();
        system.debug('jsonPro ' + jsonPro);
       
        request.setMethod('POST');
        request.setEndpoint('http://xx.xx.xx.xxx:xxxxx');
        request.setHeader('Content-Type', 'application/JSON');
        request.setBody(jsonPro);
        try{
            response = http.send(request);
        } catch(System.CalloutException e) {
            System.debug('Callout error: '+ e);
            System.debug(response.toString());
        }      
        if (response.getStatusCode() != 200){
            System.debug('Error from endpoint ' + request.getEndpoint() + ' code ' + response.getStatusCode() + ' Status ' + response.getStatus());         
            throw new RestException();
        }else{   
             system.debug('********** RESPONSE body SUCCESS !!! ' + response.getBody());
        }
       

I have a custom atricle type : faq_kav which has field: attachement of datatype: file

 

I want to display the name, summary and attachment from the above custom article using a component

 

Follwoing is query in the component controller to get the data

Select c.Id,c.Attachment__Name__s, c.Attachment__Length__s, c.Attachment__ContentType__s,c.Attachment__Body__s,  c.summary__c From faq__kav c WHERE c.PublishStatus = 'Online' and c.IsVisibleInPkb = true   and c.Language ='English' 

I keep getting error

Implementation restriction: When querying or searching the faq__kav object, you must filter using the following syntax: Id = [single ID], Id IN [list of ID's] or PublishStatus = [status]. In addition PublishStatus is only permitted in a top-level AND condition.

I donot know the Ids to query the object. Custom article type cannot be queried and displayed?

any ideas appreciated

 

Is there a way to concat String and field in HTML Email template. I want to say

{!IF(ISBLANK(Case.CaseNumber ), 'NO Case Number', 'CaseNumber is:' &  Case.CaseNumber)}

 

& doesnot seem to work. I tried + and || they donot work either. Can string be concatenated in HTML Email Templates?

When an Account is deleted, I need to update all the related cases with a new 'matched' Account Id and then delete the Original Account.

In the BeforeDelete Trigger of Account, Cases attached to the account are being successfully updated to a new matched account

However, the Delete of Original Account fails, with message 'Delete failed. as account is still associated with Cases'

 

Any ideas on why the original Account is throwing an error and not being deleted ? Do I need to disassociate original account with the cases attached to it, at the account level. If so how ?

 

Thanks,

 

In an ApexTrigger is there a way to identify if the Trigger is being called from Managed or unmanaged Package ?

Same Trigger is called from a  Managed or Unmanaged package. Due to validation rules it fails when being called from Managed package.

I would like to check the package before calling the validation rules on the Trigger.

 

 

I have 'unlimited Edition' and API enable and running as system administrator.

I have a REST API wil endpoint 'http://mycompany.com/test. I have set this URL as Remote site setting

 

The code to execute REST is below.. When  I execute the code from ny sandbox I get 403 Forbidden error. Any help appreciated

 

HttpRequest request = new HttpRequest();
        HttpResponse response = new HttpResponse();
        Http http = new Http();
        
        JSONGenerator jsonGen = JSON.createGenerator(true);
        jsonGen.writeStartObject();
        jsonGen.writeStringfield('testString', '12345');
        jsonGen.writeEndObject();
        String jsonPro = jsonGen.getAsString();
        system.debug('jsonPro ' + jsonPro);
       
        request.setMethod('POST');
        request.setEndpoint('http://xx.xx.xx.xxx:xxxxx');
        request.setHeader('Content-Type', 'application/JSON');
        request.setBody(jsonPro);
        try{
            response = http.send(request);
        } catch(System.CalloutException e) {
            System.debug('Callout error: '+ e);
            System.debug(response.toString());
        }      
        if (response.getStatusCode() != 200){
            System.debug('Error from endpoint ' + request.getEndpoint() + ' code ' + response.getStatusCode() + ' Status ' + response.getStatus());         
            throw new RestException();
        }else{   
             system.debug('********** RESPONSE body SUCCESS !!! ' + response.getBody());
        }
       

When an Account is deleted, I need to update all the related cases with a new 'matched' Account Id and then delete the Original Account.

In the BeforeDelete Trigger of Account, Cases attached to the account are being successfully updated to a new matched account

However, the Delete of Original Account fails, with message 'Delete failed. as account is still associated with Cases'

 

Any ideas on why the original Account is throwing an error and not being deleted ? Do I need to disassociate original account with the cases attached to it, at the account level. If so how ?

 

Thanks,