• A Me
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 3
    Replies
We need to make calls from Salesforce (using Apex) to an external REST Api and in some calls we need to make a PATCH callout. Why doesn't Salesforce allow making patch callouts?

Its a big issue because its a standard Http method used by many Rest Apis , and Salesforce doesn't support it. I have tried using the workarounds mentioned in one of the ideas https://success.salesforce.com/ideaView?id=0873A000000PST0QAO

Option 1 : adding "?_HttpMethod=PATCH" to the endpoint  , and using method = POST or PUT
Unfortunately this workaround doesnt work if the Rest API one tries to access doesn't allow it, as in my case. Response received is "method not allowed"
Option 2 : Set the method to "POST" and this line is added to code
req.setHeader('X-HTTP-Method-Override','PATCH');
This doesn't work either and the error message is same as the previous one.

This is a deadend. Unless Salesforce enables PATCH callouts or there is a workaround that would work.
Can someone help please?
  • December 27, 2018
  • Like
  • 0
Hi,

We have a scenario where we would like to link files to contact records in Salesforce, but keep the visibility limited to a few users(or chatter group). The contact's account has public read/write access. Is it possible? Salesforce help says that the file's access would be determined by the record's access. But could we limit the file's access without changing the account's access?
The problem currently is that even though the file's sharing settings show that no user has access to the file, all users can see the file.
If we add the file to a private group, that would be one way to limit access but then we cant link it to the contact record.
Please suggest if there is a way to do this.

Regards,
Ame.
 
  • March 06, 2018
  • Like
  • 0
Hi,

I have a lightning component controller that makes call to apex controller in the init handler
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
The function calls an apex controller method which returns a wrapper class(say CustomWrapperClass):
CustomWrapperClass{
public <Date,String> map1{get; set;}
public <Date,String> map2{get; set;}
public String str1 {get; set;}
}

The component has these attributes defined
The client side controller has wrapper attribute defined 
<aura:attribute name="mywrapper" type="CustomWrapperClass" />
<aura:attribute name="myMap" type="Map" />

Here is the handler code
doInit : function(component, event, helper) {
        var queryAction = component.get("c.getWrappedResults"); //apex method name getWrappedResults
       queryAction.setCallback(this, function(response) {
       var wrapper = response.getReturnValue();
      if (paymentWrapper == null)
                return;
     //Code to assign the wrapper's map variables to component's attribute Map1
    });
     $A.enqueueAction(queryAction);
    } 

How to assign the custom wrapper class's map member (Map1) to MyMap attribute of the component and then also output its key value pairs on the component?
Can we somehow use wrapper.map1 ?



Regards,
A M    
  • February 16, 2017
  • Like
  • 0
Hi,

I want to do a Math.mod operation on a string (contains numeric values only) in an apex class. The maximul length of the string is 19.
Here is a sample value : 57901220028758151855

The problem is when I try to convert this to Long using Long.valueOf(string) , there is a type exception : invalid long
So I tried to get the long value using : Decimal.valueOf(string).longValue() , but when I check the value using System.debug  & it is = 2560987807629497007 , not the same as the original, so the mod result is also not correct.
I have to convert to Int, or Long because those are the only 2 types accepted by Math.mod(). and the max length of Integer is too small for these numeric strings.

The same operation is being performed in a validation rule using MOD (VALUE(string),divisor) with no problems.

Please help.

Regards,

A Me

  • September 12, 2014
  • Like
  • 0
Hi,

I am writing a web service which will validate the incoming request and create a custom object record based on the parameters in the request. The custom object has 2 record types (say 'A' and 'B') . The web service creates records of record type 'A' only .
One of the fields of the object is a picklist , type__c , and the web service must validate the value of this field in the request. So it must check that the incoming value is one of the picklist values permissible for record type 'A' of the custom object.

I have checked several posts, but all of them involve visualforce pages and their controllers. How can this be achieved in apex, without VF pages?
  • July 21, 2014
  • Like
  • 0
I want to call an external web service from my apex code.
According to the WSDL , one of the parameters which are mandatory to make the request is the web service platform. When I checked the API documentation of the web service, it says that the value of this parameter should be the web service technology which I use when I call this web service.
They also have a list of whitelisted technologies (which they say are valid platforms) for calling this webservice, namely DOTNET20,ZSI,SUDS, WCF and PHP5.
Could anyone help me with this?
  • May 14, 2014
  • Like
  • 1
I want to call an external web service from my apex code.
According to the WSDL , one of the parameters which are mandatory to make the request is the web service platform. When I checked the API documentation of the web service, it says that the value of this parameter should be the web service technology which I use when I call this web service.
They also have a list of whitelisted technologies (which they say are valid platforms) for calling this webservice, namely DOTNET20,ZSI,SUDS, WCF and PHP5.
Could anyone help me with this?
  • May 14, 2014
  • Like
  • 1
Hi,

I want to do a Math.mod operation on a string (contains numeric values only) in an apex class. The maximul length of the string is 19.
Here is a sample value : 57901220028758151855

The problem is when I try to convert this to Long using Long.valueOf(string) , there is a type exception : invalid long
So I tried to get the long value using : Decimal.valueOf(string).longValue() , but when I check the value using System.debug  & it is = 2560987807629497007 , not the same as the original, so the mod result is also not correct.
I have to convert to Int, or Long because those are the only 2 types accepted by Math.mod(). and the max length of Integer is too small for these numeric strings.

The same operation is being performed in a validation rule using MOD (VALUE(string),divisor) with no problems.

Please help.

Regards,

A Me

  • September 12, 2014
  • Like
  • 0
Hi,

I am writing a web service which will validate the incoming request and create a custom object record based on the parameters in the request. The custom object has 2 record types (say 'A' and 'B') . The web service creates records of record type 'A' only .
One of the fields of the object is a picklist , type__c , and the web service must validate the value of this field in the request. So it must check that the incoming value is one of the picklist values permissible for record type 'A' of the custom object.

I have checked several posts, but all of them involve visualforce pages and their controllers. How can this be achieved in apex, without VF pages?
  • July 21, 2014
  • Like
  • 0
I want to call an external web service from my apex code.
According to the WSDL , one of the parameters which are mandatory to make the request is the web service platform. When I checked the API documentation of the web service, it says that the value of this parameter should be the web service technology which I use when I call this web service.
They also have a list of whitelisted technologies (which they say are valid platforms) for calling this webservice, namely DOTNET20,ZSI,SUDS, WCF and PHP5.
Could anyone help me with this?
  • May 14, 2014
  • Like
  • 1