• JLA.ovh
  • SMARTIE
  • 556 Points
  • Member since 2011
  • Capgemini


  • Chatter
    Feed
  • 17
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 106
    Replies
I am trying to remove space(dynamically) of input string:

Example: string: ' inputString ', Expecting O/p: 'inputString'
Example like : ' Ravi kumar ' Expecting O/p:'Ravi kumar'

I want to remove the space before or after the string or both before and after, not in the middle.

I tried the following but it is removing all the spaces including middle.

inputString = inputString .replaceAll( '\s+', '');
Is it possible to have the REST API return the value of a formula field when creating a record? I know that the payload returns the record ID, but would like other field values returned as well in order to not have to make a second call. For example the response body for a new account might look like:
 
{
  "id" : "001D000000IqhSLIAZ",
  "errors" : [ ],
  "success" : true
  "Formula_field__c" : "Formula field value"
}

 
public class Data{
    List<Account> Acclist{
        get{
            Acclist = [SELECT(SELECT LastName, Phone, Email FROM Account.Contacts)Name FROM Account];
    
    return Acclist;

    }
    set;
    }
   }
Hello,

I want to transfer all the Inactive user to a Profile called "Inactive users", I want to use an Apex code or Data loader to do so ?

How can i implement it ?
  • September 13, 2016
  • Like
  • 0
Hi, I am trying to add hours in a datetime in apex. It seems that it is not working, am I missing something?
Below is the code:
@istest

class DateFormatTest {

   static testmethod void test() {
        String myDtString;
        String timestart = '2016-09-02 18:15:26';
        Datetime dt = Datetime.valueOf(timestart);
        
        myDtString = dt.format('MM/dd/yyyy hh:mm a');
        System.debug('1: '+ myDtString); //result: 1: 09/02/2016 06:15 PM
        
        dt.addHours(3);
        myDtString = dt.format('MM/dd/yyyy hh:mm a');
        System.debug('2: '+ myDtString); //result: 2: 09/02/2016 06:15 PM

   }
}

If you look at it, the results are the same after adding 3 hours.
Question:
  •  I want to understand, if we are using Winter-17 non preview sandbox then what will happen to 'Non-preview sandboxes' after Winter 17 release to production which is scheduled for Oct-15, 2016.
  • Sandboxes will also automatically update to Winter 17 or it will stay on older version and we have to refresh sandbox after Oct 15th, 2016?.
 
To me more specific, please refer below senario
 
  • If we refresh sandbox on 15th Sept 2016 then even after 15th Oct 2016 we will not get Winter 17  in our sandboxes.
  • Only way to get Winter 17 in these(non-preview) sandboxes is refresh after 15th Oct 2016?
 
Thanks
  • September 02, 2016
  • Like
  • 0
Hey everyone, 

Im new to using canvas, and JS canvas Library.
Im trying to connect an app coded in PHP to my salesforce org and canvas.
For that im trying to use some JS code in my php. 
What I need is getting Salesforce Session ID using Salesforce JS canvas methods. Problem is : i have no clue how to do it, I've been looking all over the web and found no solution.

Can anyone help ?

Thanks in advance :)

I have a valid access token (from oauth login flow) and Contact PhotoUrl value (from a REST API call).

Is there a way to combine this two and construct a HTTP browser request that could actually allow me to fetch the image?

As per documentation, PhotoUrl returns a path to be combined with the URL of a Salesforce instance (which I also have) to generate a URL to request the profile image associated with the contact. Generated URL returns an HTTP redirect (code 302).

Everything works as long as user is logged into salesforce in the same browser session. But once the session is out, this generated URL returns 401 error instead of 302 redirect. Because I have a valid oauth access token (from some out of band way) I could pass it with the request to fetch the image.

I found some undocumented property of this PhotoUrl - if you append ?oauth_token=<valid access token> to it you will actually make the redirect and get final image url, e.g. something like https://yourInstance.salesforce.com/profilephoto/005/T

But browser cannot fetch this image, because the session is still out. Simple https://yourInstance.salesforce.com/profilephoto/005/T?oauth_token=<valid access token> would do the trick, but all query params are getting stripped during 302 redirect, and as of my knowledge there is no way to get value after the redirect from the browser.

Does anyone have any idea how browser could fetch actual image using data I mention?
 

Hi,

When we are using the "external data object", the Salesforce doesn't use any space to store data ? Absolutely nothing ?

Thank you !!!
Hi I have completed the challenge, but the Cloak of Adventure badge hasn't appeared and no information about the sweatshirt.

What do I need to do?

Thanks

Paul
I am trying to complete this module in Trailhead, but when I search for Visualforce pages as dictated in the instructions I get an error message.  See image. Error message
{!REQUIRESCRIPT("/xdomain/xdomain.js")} 
{!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")} 
{!REQUIRESCRIPT("/support/console/33.0/integration.js")} 

var a = {!LEN( $Setup.New_Opportunity_Settings__c.RecordTypeId__c )}; 

if (a > 0) { 
window.parent.navigateToUrl('/006/e?retURL={!Contact.Id}&RecordType={!$Setup.New_Opportunity_Settings__c.RecordTypeId__c}&{!$Setup.New_Opportunity_Settings__c.ContactFieldNameId__c}={!Contact.Name}&{!$Setup.New_Opportunity_Settings__c.PrimaryContactFieldId__c}={!Contact.Id}&accid={!Account.Id}'); 
} else { 
window.parent.navigateToUrl('/setup/ui/recordtypeselect.jsp?ent=Opportunity&retURL={!Contact.Id}&save_new_url=/006/e?retURL={!Contact.Id}&{!$Setup.New_Opportunity_Settings__c.ContactFieldNameId__c}={!Contact.Name}&{!$Setup.New_Opportunity_Settings__c.PrimaryContactFieldId__c}={!Contact.Id}&accid={!Account.Id}'); 
}

This is an onclick javascript button that is on a contact page layout, allowing the user to create a new opportunity.  Seems to work most of the time but occasionally it doesn't, with the error "missing ) after arguments list".  Wondering if anyone knows why this would happen on some contacts not others.
How can i restrict users to login salesforce with same username from different sources (Desktop, Phone, Tablet) with same IP Address and similar login hours ?
How can we restrict user from accessing Salesforce.com on Internet Explorer and Mozilla apparently he should be allowed to access on google crome?
Hello,

Do you think taking all the developers Trailhead is a good studing for the Salesforce 401 certification?

Thanks,

Egidio
Hello,

I have achieved all steps for this badge but I can't receive the badge, it is stuck at 75%, because of this status :
1. Create a New Process on the Account Object - Step Complete!
2. Add Process Criteria - Incomplete
3. Add Your Process Action - Step Complete!
4. Test Your Process - Step Complete!
When going to the "Add Process Criteria", it is stated as Complete! (see snapshot below)
Step completed
On the right we have the green "complete" and below we have the points.
There is no way to retake the step or reset the badge, the detail of this badge (the steps) is not matching the summary of the badge
I cannot receive the badge even if it has been done
Any Idea for a workaround to correct this situation ?
I need to see the the account which have 1 or more records for X child object. 
Parent - Account 
Child - Account team.
using work bench i need to see the which account have 1 or more records in Account team.
Please help me with query to see the list. 


Thanks,
Hello,
I have a problem, I want create a formula between saleforces objects but I have an error message.
"Erreur : Le champ Questionnaires__r n'existe pas. Vérifiez l'orthographe"
IF(AND(Respect__c=Questionnaires__r.Respect__c,Respect__c= True),1,0)
My object "Questionnaires__c" is available, can you explain me ?
Thank in advance.
I am trying to remove space(dynamically) of input string:

Example: string: ' inputString ', Expecting O/p: 'inputString'
Example like : ' Ravi kumar ' Expecting O/p:'Ravi kumar'

I want to remove the space before or after the string or both before and after, not in the middle.

I tried the following but it is removing all the spaces including middle.

inputString = inputString .replaceAll( '\s+', '');
Hi ,

I have a trigger where i am getting the following exception often 

System.LimitException: Apex CPU time limit exceeded

Please help me how to fix this issue
MY TRIGGER :

trigger AccconRshipUpdate on Contact (after insert, after Update,after delete,after undelete){

    try{
        Trigger_Status__c ts = Trigger_Status__c.getValues('AccconRshipUpdate');
        if(ts.Active__c) { 
    if ((trigger.isafter && trigger.isInsert) || (trigger.isafter && trigger.isUpdate)) {
            accConRshipUpdateonContacts.AccContactInsUpdate(trigger.new);
          }
    if ((trigger.isafter && trigger.isInsert) || (trigger.isafter && trigger.isUpdate) || (trigger.isafter && trigger.isdelete)|| (trigger.isafter && trigger.isUndelete))      
         {
          Contact[] cons;
            if (Trigger.isDelete)
                    cons = Trigger.old;
            else
                    cons = Trigger.new;
            RollupofCLcontactsHandler.CountNumofContacts(cons);    
         } 
       }
   }catch(Exception e){
        System.debug('Error Occured From AccconRshipUpdate  Trigger: '+e.getMessage());
    }
}



Kindly help me pls

Thanks in Advance
I need to create a user report that shows user login, logout, duration of login for each instance.
Can I use EventLogfile to get this information, if so How can I access to this EventLogFile? 
I run a query against this object, and saw it was a txt/csv file. 
How can I download it from workbench? 
This link from trailhead is about EventLogFIle but did not provide technical guide to download the file.

https://trailhead.salesforce.com/en/modules/event_monitoring/units/event_monitoring_intro
 
Greetings all. I am new to the Developer world and working through the material and practicing. Taking place in the solution of requirements at Staples, I have come across a confusing topic. At least for me it is.

There is a lot of intergration between our Salesforce instance and various applications. The topic of creating a pleasant user experiene and efficient interaction between a home grown application and our Salesforce instance. The proposed option is to integrate this interface through an iFrame soultion. 

My questions is what is the difference/benefits between using an iFrame or incorporating this home grown app into Salesforce via Force.com Canvas?

I would really appreciate if somebody could explain this in plain english. I keep reading the material but it is a little out of my knowledge level and I would truly like to understand it.

Thanks!
Hi All,

The salesforce standard lead object has 50000 + records in salesforce. I can get the size of the leads records by checking the storage usage under Data Management setup. Is there anyway to know the total attachments size in salesforce for the lead object also.

 
We have a Salesforce Client that fetches user and other attributes from Slaesforce server, along with this we also want to fetch  "IsFrozen" attribute.
The IsFrozen attribute is present in UserLogin and can be fetched using below query "SELECT UserId, IsFrozen FROM UserLogin". 
But we already make a lot of calls to the Salesforce server where we get the API exceeding exception.
Hence is it possible to fetch IsFrozen attribute using below query.

Select Id  , Alias , City , CommunityNickname , CompanyName , CallCenterId , Country , Department , Email , Division , EmployeeNumber , Extension , Street , Fax , IsActive , Username , FirstName , LastName , EmailEncodingKey , Name , UserPermissionsMarketingUser , UserPermissionsMobileUser , UserPermissionsOfflineUser , UserPermissionsSFContentUser , Phone , ProfileId , Profile.Name , ReceivesAdminInfoEmails , UserRoleId , UserRole.Name , UserType , State , Title , ReceivesInfoEmails , Profile.UserLicense.Name , LanguageLocaleKey , LocaleSidKey , TimeZoneSidKey , FederationIdentifier , TESTKEY__c , Manager.Name , Profile.Id , UserRole.Id from user WHERE user.IsActive = true


 
We have a Url Button to access and process a record in Salesforce.
The user clicks a page link/button and the url which contains &sfSid={!API.Session_ID}&sfEndpoint={!API.Partner_Server_URL_360}
We use the endpoint/sid to log into Salesforce via SOAP and then access/process the record (cannot be done via APEX :-()

This works absolutely fine in Classic.
In Lightning, it works, if the Button is Detail Page Link with Display in new Window.
This creates an ugly full page screen with "You will be redirected to ... Click the button below to go to that page."

Looking for alternatives in Lightning, a Detail Page Button produces a nicer popup "Navigate to this page? .."
BUT when trying to login via SOAP with the endpoint/session provided via SOAP, we get the error:

[UnexpectedErrorFault [ApiFault  exceptionCode='INVALID_SESSION_ID'
 exceptionMessage='Invalid Session ID found in SessionHeader: Illegal Session'
]

The endpoint/sid "look ok".
Sometime ago, I read that there are different types of sid's ??

Obviously even in Lightning some values created by {!API.Session_ID} work and other's don't.
What are the different types or SID's and how do I manage/distinguish them?
How can I make it work in all cases??

Thanks!
Jorg
I am trying to make a request to an identity URL in a sandbox enviroment from an external domain. I am making the request using javascript with an endpoint such as https://test.salesforce.com/id/ORGID/USERID?oauth_token=access-token, which gives me the error
"XMLHttpRequest cannot load ..... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://example.example.com' is therefore not allowed access."
I realise this is to do with CORS, so I followed the steps at https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/extend_code_cors.html, setting the origin URL to https://example.example.com. Unfortuantely I am still getting the same error. Is there some extra step involved that I am missing? Any help would be appreciated.
 
I'm trying to determine If I need 2 API logins VS one. Scenario: 1 process Calls periodically throughout the day (SOAP), 2nd Process does a BULK API at 8AM, 12PM, 3 PM. What happens if the 1st process is in a session, and the 2nd process starts up? does it stop the 1st session or vice versa, if the 1st API interupts the session of the bulk api?

Does the Bulk API work like the SOAP API and begins a session (I assume so)
Is it possible to have the REST API return the value of a formula field when creating a record? I know that the payload returns the record ID, but would like other field values returned as well in order to not have to make a second call. For example the response body for a new account might look like:
 
{
  "id" : "001D000000IqhSLIAZ",
  "errors" : [ ],
  "success" : true
  "Formula_field__c" : "Formula field value"
}

 
Hi there,
How can I monitor email sent from Salesforce using REST API in PHP?
I can't find any reference...
Regards,

 

trigger OpportunityAfterUpdate on Opportunity (after update) 
{
    if(PAD.CanTrigger('AP16')){
        Id recTypeId = [SELECT Id FROM RecordType where SobjectType='Opportunity' AND DeveloperName =:'Local_Opportunity' limit 1].Id;
        List<Id> listOpp = new List<Id>();
        System.debug('##############Trigger step 1');
        for(Opportunity o : Trigger.New){
            if(o.recordTypeId == recTypeId && o.StageName == 'Inforce' && o.Existing_Contract__c != null && Trigger.oldMap.get(o.Id).StageName != Trigger.newMap.get(o.Id).StageName && o.Create_LP__c == false){
                listOpp.add(o.Id);
            }
        }

}

what is meant by "PAD.CanTrigger('AP16')"?

  • April 09, 2013
  • Like
  • 0

Hi Friends,

 

I need to know how to the query the records from custom label object. Is it possible to query the data from this object? As we do the same from other objects like Account, Contact, ......

We can use labels in our controller, like Label.<Label_Name>.

 

while i am trying to query the data from customLabel, it is throwing error like :

 

"line 1, column 20: sObject type 'CustomLabel' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names."

 

Please help me in this, how to use this object in apex controller.

 

Thanks in advance.

 

Regards,

Phanikumar