• Sridhar Narayansa
  • NEWBIE
  • 40 Points
  • Member since 2015

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 16
    Replies
AND(
Or(
(ISPICKVAL(StageName , "9 - Closed/Lost (0%)")),
(Ispickval(StageName, "6 - Closed/Won (100%)"))),
 
ISBLANK(Text( Close__c )), 
 
or(not
($RecordType.Name = "Existing Business Renewal '17",
$RecordType.Name="Service/SOW '17",
$RecordType.Name="Recurring Revenue"))
)
 
Hello,

We are introducing communities for customer service. We have users the ability to create a Case and ability to attach a file to a case.
This cases and files are later accessed by internal agents.

Since salesforce does not guaratee that files attached by customers are free from malware, our organization requires that all attachments uploaded by customer be scanned using Internal pre-approved virus scanning tool. For this we have to call an API which performs the virus scan using REST API. We are not allowed to use any third party app exchange products.

While calling REST API for virus scan, we are converting file to base64 encoded file in the payload. This works fine for small files.

For files that is larger, we are hitting Heapsize limit defined by Salesforce.

Ideally, we want files as large as 20MB be available to be processed using REST API. How can I process large files in Apex transaction?

Does anybody have any workaround?
Any other ideas on how other places have performed virus scan on attachments for community users?

Thanks.,
Sridhar

 
Hello, 

We have a requirement to do a HTTP Post to AEM (Adobe Experience Manager). 

This service at AEM returns back with the message showing number of parameters and key-value information. (Just an echo for testing).

I am facing a wierd challenge where I posting a file to AEM using HTTP Post multipart form data as in the below code but somehow AEM is not able to identify any parameters being sent within the body.

When we test the same AEM service using Postman it works fine. It replies back with number of parameters and keyvalue pairs that exist in the message body.

I constructed the same multipart message in Salesforce and invoked httppost to AEM, I get null value returned. On taking to AEM team, they mention that message is not being constructed correctly.

So started to sending the Multipart messages to thirdparty clients like postbin, requestbin or beeceptor. They all seem to be fine. I compared this with how postman would send. It looks fine. 

In summary:
Postman to AEM - worksfine

Compared  Postman message and Salesforce multipart message using requestbin. looks good.

But Saesforce to AEM - doesnt work.

Has anybody experienced similar issue? anybody has integrated with AEM?
I am suspecting that it has something to do with charactersets, but I dont know what could be wrong. I am not sending any special characters.
Any suggestions?
 
public class ABCService_v2 {
    
    public static void addJobApplication() {        
        
        // Set body
        String boundary = '----------------------------' + String.valueOf(DateTime.now().getTime());
        String body = '--' + boundary + '\r\n';
        body += 'Content-Disposition: form-data; name="buildingId"\r\n\n';
        body += 'id_building\r\n';
        body += '--' + boundary + '\r\n';
        body += 'Content-Disposition: form-data; name="buildingName"\r\n\n';
        body += 'Fashion101\r\n';
        body += '--' + boundary + '\r\n';
        body += 'Content-Disposition: form-data; name="suiteName"\r\n\n';
        body += 'Suite-100\r\n';
        body += '--' + boundary + '--';
 
        // Instantiate a new HTTP request
        HttpRequest req = new HttpRequest();
        
        // Set method and endpoint
        //req.setEndpoint('http://https://requestbin.fullcontact.com/1hlgohv1');
        req.setEndpoint('https://someservicedev-dev.someservice.com/bin/io/floorplan');
        req.setMethod('POST');
        
        
        // Specify the required user name and password to access the endpoint
        // As well as the header and header information
        
        String username = 'jdoe';
        String password = 'jdoe123';
                
        
        // Set headers
        req.setHeader('Content-Type', 'multipart/form-data; boundary=' + boundary);
        req.setHeader('Content-Length', String.valueof(body.length()));
        //req.setHeader('Accept-Charset', 'utf-8, iso-8859-1;q=0.5');
        req.setHeader('Accept-Charset', '*');
        req.setHeader('Accept-Encoding', 'gzip, deflate');
        req.setHeader('Connection', 'close');
        req.setHeader('Accept','*/*');
        Blob headerValue = Blob.valueOf(username + ':' + password);
        String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
        req.setHeader('Authorization', authorizationHeader);
        
        //Set Body
        req.setBody(body);
        
        // Send HTTP request and get HTTP response
        Http http = new Http();
        HttpResponse res = http.send(req);
        system.debug('==============res: ' + res.getBody());
    }
}









 
Hello,

We are introducing communities for customer service. We have users the ability to create a Case and ability to attach a file to a case.
This cases and files are later accessed by internal agents.

Since salesforce does not guaratee that files attached by customers are free from malware, our organization requires that all attachments uploaded by customer be scanned using Internal pre-approved virus scanning tool. For this we have to call an API which performs the virus scan using REST API. We are not allowed to use any third party app exchange products.

While calling REST API for virus scan, we are converting file to base64 encoded file in the payload. This works fine for small files.

For files that is larger, we are hitting Heapsize limit defined by Salesforce.

Ideally, we want files as large as 20MB be available to be processed using REST API. How can I process large files in Apex transaction?

Does anybody have any workaround?
Any other ideas on how other places have performed virus scan on attachments for community users?

Thanks.,
Sridhar

 
Hello All,

Below is my code,

List<Case> localemailaddress = new List<Case>([SELECT ID,AV_Local_Affiliate_Inbox__c FROM Case Where Id IN : newCaseMap.keySet()]);
if(localemailaddress.size()>0){
                String email=String.valueOf(localemailaddress.get(0));
                    system.debug('Raj debug' +email);
                 OrgWideEmailAddress[] owea = [select Id from OrgWideEmailAddress where Address =:email];


Eventhough i checked for Null case exception. I am gettingSystem.ListException: List index out of bounds: 0 this erroe.

Can anyone please tell me why ?
Urgent !!

Thanks in advance.
How can i update a check box in all parent account above the hierarchy from the child account check box?
I am trying to access the apex rest service defined in Salesforce org B from Salesforce org B using named credentails. 

I have performed following steps- 
  • Create Connected App in Salesforce Org B
  • Create Auth. Provider in Salesforce Org A, add consumer secret and key. Copy callback URL. 
  • Update Connected App in Salesforce Org B with Callback URL.
  • Go to Org A --> Create Named Credential --> Select the Oauth --> Select the Auth Provider created earlier  --> Set scope as refresh_token full
     -> Start Authentication Flow on Save --> authorize using Org B
  • Use this Named Cred. in Apex code. 
Code Snippet:
        HttpRequest req = new HttpRequest();
        req.setEndpoint('callout:Connect_to_My_Salesforce_Org/services/apexrest/account/');
       
        req.setBody('{"accId":"'+accId+'"}');
        req.setMethod('POST');
        req.setTimeout(12000);
        req.setHeader('Content-Type', 'application/json');
        Http h = new Http();
       
        HttpResponse res;
       
          res = h.send(req);  
       
        System.debug(' Response '+ res);
        System.debug(' Body '+ res.getBody());

I am getting read timed out error/ Unexpected end of file from server if timed out is set to 120 seconds. 
I have whitlisted all ip addresses in Network setting.
Could you please help what is wrong here?

Thanks in advance.
We are in the middle of a deployment and the change set upload is failing with error code 104070323-38507 (245827274)

Can anyone give more information as far as what is causing it to fail?

Thanks.
Hi -- We have created a Visualforce page and where we are sending Email Conformation to a customer,
But it is only working for Gmail Domain but it is not working for all other domain like Yahoo. AOL.
I currently am working on creating an Apex Class that initiially pulls a specific set of Placements (jstcl__Placement__c) and puts them in a list. 
It then takes that list of Placement Ojects and edits a relevant field called TimecardEnddateAudit__c field. I keep getting errors saying that the field jstcl__Timesheet_Period__c that exists in some of my if logic does not exist. Logically it should edit fields according to the logic:" If the jstcl__Timesheet_Period__c field is equal to 'Weekly Split' then add .5, else add 1. 
public class CamstimecardEndDateAudit{
public static void auditTimeCards(){

List<sObject> placements = [SELECT jstcl__Placement__r.Name
                            FROM jstcl__TG_Timesheet__c 
                            WHERE jstcl__Placement__r.ts2__Status__c IN ('Active') 
                             AND jstcl__Week_Ending__c = LAST_N_DAYS:15
                             AND jstcl__Status__c = 'Pending'];
                             
    for(List<sObject> A : placements){

        if(A.jstcl__Timesheet_Period__c = 'Weekly Split'){
        
        TimecardEndDateAudit__c = TimecardEndDateAudit__c + 0.5;}
        
        else{
        
        TimecardEndDateAudit__c = TimecardEndDateAudit__c ++;
}
}
}}

 
Hi all, 

I am trying to create a auto populated field. We have a custom object, 'Engagement'. I want to create a new field under contacts that shows engagments that are starting soon. Ideally when an engagement has a confirmed start date that is greater than today it will be shown in this field. 

Does anyone have any advice how I could do this? 
Hello, 

We have a requirement to do a HTTP Post to AEM (Adobe Experience Manager). 

This service at AEM returns back with the message showing number of parameters and key-value information. (Just an echo for testing).

I am facing a wierd challenge where I posting a file to AEM using HTTP Post multipart form data as in the below code but somehow AEM is not able to identify any parameters being sent within the body.

When we test the same AEM service using Postman it works fine. It replies back with number of parameters and keyvalue pairs that exist in the message body.

I constructed the same multipart message in Salesforce and invoked httppost to AEM, I get null value returned. On taking to AEM team, they mention that message is not being constructed correctly.

So started to sending the Multipart messages to thirdparty clients like postbin, requestbin or beeceptor. They all seem to be fine. I compared this with how postman would send. It looks fine. 

In summary:
Postman to AEM - worksfine

Compared  Postman message and Salesforce multipart message using requestbin. looks good.

But Saesforce to AEM - doesnt work.

Has anybody experienced similar issue? anybody has integrated with AEM?
I am suspecting that it has something to do with charactersets, but I dont know what could be wrong. I am not sending any special characters.
Any suggestions?
 
public class ABCService_v2 {
    
    public static void addJobApplication() {        
        
        // Set body
        String boundary = '----------------------------' + String.valueOf(DateTime.now().getTime());
        String body = '--' + boundary + '\r\n';
        body += 'Content-Disposition: form-data; name="buildingId"\r\n\n';
        body += 'id_building\r\n';
        body += '--' + boundary + '\r\n';
        body += 'Content-Disposition: form-data; name="buildingName"\r\n\n';
        body += 'Fashion101\r\n';
        body += '--' + boundary + '\r\n';
        body += 'Content-Disposition: form-data; name="suiteName"\r\n\n';
        body += 'Suite-100\r\n';
        body += '--' + boundary + '--';
 
        // Instantiate a new HTTP request
        HttpRequest req = new HttpRequest();
        
        // Set method and endpoint
        //req.setEndpoint('http://https://requestbin.fullcontact.com/1hlgohv1');
        req.setEndpoint('https://someservicedev-dev.someservice.com/bin/io/floorplan');
        req.setMethod('POST');
        
        
        // Specify the required user name and password to access the endpoint
        // As well as the header and header information
        
        String username = 'jdoe';
        String password = 'jdoe123';
                
        
        // Set headers
        req.setHeader('Content-Type', 'multipart/form-data; boundary=' + boundary);
        req.setHeader('Content-Length', String.valueof(body.length()));
        //req.setHeader('Accept-Charset', 'utf-8, iso-8859-1;q=0.5');
        req.setHeader('Accept-Charset', '*');
        req.setHeader('Accept-Encoding', 'gzip, deflate');
        req.setHeader('Connection', 'close');
        req.setHeader('Accept','*/*');
        Blob headerValue = Blob.valueOf(username + ':' + password);
        String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
        req.setHeader('Authorization', authorizationHeader);
        
        //Set Body
        req.setBody(body);
        
        // Send HTTP request and get HTTP response
        Http http = new Http();
        HttpResponse res = http.send(req);
        system.debug('==============res: ' + res.getBody());
    }
}









 
Hi All,

  I am trying to transform a string pattern lets say 'aaabbbcccbbsc' to a3b3c3b2s1c1.

Below is the code.
public class StringPracticeduplicatecount {
    public  void stringpatterns(String s)
        {
            
              string newstr;
                 list<String> liststr=s.split('');
            system.debug('::'+liststr);
            integer count = 1,i=1;

            for (integer j = 0; j < s.length(); j++)
            {
                if (i<s.length() && liststr[i] == liststr[i - 1])
                {
                    count++;
                }
                else
                {
                    newstr = newstr + liststr[i - 1] + count;
                    count = 1;
                }
                i++;
            }

            system.debug( 'output:  ' + newstr);
        }

}
The code is working fine but when i open the debug log it is showing 'List Size is too large to display'.How to avoid this error?
And also I want to  know if there is any other approach to get the solution.
Any help is greatly appreciated.
Thanks,
Sirisha
 
Hello
I have a urgent requirement as follows.
There is historical data in account object , it has 2 million records.
Account object has two fields with same data type say shipcode and billcode and I need to compare values in these two fields.
I am thinking of batch apex but if the matching rows are say 1Lakh then I cannot store in a list variable.
somebody told me about formula field but I am not sure how to go about this.
The aim is to create a report by including the formula field, but I am assuming about 1Lakh matching can turn up,
Please advise , elaborate wherever possible

Thanks
Krishna

 
I am attempting to execute a simple SOQL query on objects with two-word names, and it is proving surprisingly difficult. 

The query below works fine:
"select name from user limit 10"

I want to execute something similar on an object called "User Emails" - I know that is the name as it was pulled from the schema builder. However, any simple query on this table fails, no matter what format of the two-word name I try.

For example: 
"select date from user_emails limit 10" 
This fails with the error "Object type 'user_emails' is not supported". This is true of any format of the object name I have tried (useremails, UserEmails, user-emails, etc).

What is the correct way to query these objects? 


 
I am working with a customer that has a self-signed certificate which has expired.  They have no single signon rules defined.  I created a new certificate and it shows as active.  The expired cert also shows as expired, but the active box is checked.  I don't see any way to remove it.  Do I need to?  Is there anything else I need to do for the new cert?
Hi all,

I have the requirement to get a field autopopulated according to the value of another field.
For example, I have the parent object Postgraduate Course. This has the related list Questions (Preguntas):

The Question object has a lookup to the Postgraduate Course.
To distinguish among postgraduate courses with the same name, we use one field: the Edition of the Postgraduate Course.

The Question edit mode looks like this:

User-added image

For example, if the Postgraduate Course is SEGURIDAD CLINICA and the Edition of that Postgraduate Course is 2017-2018, when you click on the button New on the related object Questions, the field Edtion on this object should be autopopulated with the value in the field Edition of the Postgraduate Course, being in Edit Mode, so our client can recognize for which Postgraduate Course he will add a question.

Is something like that possible in Salesforce?.
AND(
Or(
(ISPICKVAL(StageName , "9 - Closed/Lost (0%)")),
(Ispickval(StageName, "6 - Closed/Won (100%)"))),
 
ISBLANK(Text( Close__c )), 
 
or(not
($RecordType.Name = "Existing Business Renewal '17",
$RecordType.Name="Service/SOW '17",
$RecordType.Name="Recurring Revenue"))
)
 
I try it with curl and it works but I don't know why it doesn't work on my workplace
curl -v https://login.salesforce.com/services/oauth2/token -d "grant_type=password&client_id={clientid}&client_secret={clientsecret}&username={emailadd}&password={password+securityToken}" -H "Content-Type:application/x-www-form-urlencoded"

I also try it in my own laptop and it works. That's what I don't understand. I used the same jar file for httpclient for both pc and in my laptop it works but not on my work place. Is there any other reason why it doesn't work this is the sample code


CloseableHttpAsyncClient client = HttpAsyncClients.createDefault();
    client.start();
    
    String authenticationUrl = "https://login.salesforce.com/services/oauth2/token";
    
    // authentication
    HttpPost requestPost = new HttpPost(authenticationUrl);
    requestPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
    requestPost.setHeader("Accept", "application/json");
    
    List<NameValuePair> params = new ArrayList<>();
    params.add(new BasicNameValuePair("grant_type", "password"));
    params.add(new BasicNameValuePair("client_id", client_id));
    params.add(new BasicNameValuePair("client_secret", client_secret));
    params.add(new BasicNameValuePair("username", username));
    params.add(new BasicNameValuePair("password", password+securityToken));
    requestPost.setEntity(new UrlEncodedFormEntity(params));
    HttpResponse response = client.execute(requestPost, null).get();
    
    
    System.out.println("Status code:" + response.getStatusLine().getStatusCode());
    System.out.println("Entity: " + response.getEntity().getContent().toString());
    
    HttpEntity entity = response.getEntity();
    String responseString = EntityUtils.toString(entity, "UTF-8");
    System.out.println(responseString);