• SFDC_Developer
  • NEWBIE
  • 45 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 4
    Likes Received
  • 0
    Likes Given
  • 24
    Questions
  • 26
    Replies
I need to create a button on the account object that adds the users name to a custom field which is a lookup field to the user object. This field is similar to the account owner field
Hi,

My current client has 6 Prod Org, now they want to track license detail of all the org and their usage.
Like they want to track which user has which Org access, license information,profile and permission set.

Currently we have created two custom object which has master-detail relationship in one org, where Master object will store user information and detail object will store org information like Org name, profile etc.

Currently we are manually uploading data in all these object, but in future we want to automatically upload all these details, like whenever a new user is created or deactivate in any Org it should automatically updated in my custom object.

How can I achieve this? Is there any alternative approach of doing this apart from creating custom object?
Below is my bat file which is used to schedule data export from data loader but on running this I am getting "The system cannot find the path specified" error.
 
@echo off
SET DLPATH=”C:\Program Files\salesforce.com\Data Loader”
SET DLCONF=”C:\Users\abcdef\Desktop\CLIDataloader”

REM Initiating the BatchLoad
REM AccountExtract
CALL %DLPATH%\Java\bin\java.exe -cp %DLPATH%\dataloader-28.0.1-uber.jar -Dsalesforce.config.dir=%DLCONF%  com.salesforce.dataloader.process.ProcessRunner process.name=AccountExtract

Exit


Below code is working but I want to make my file more dynamic like file name based on date
 
@echo off
CD C:\Program Files\salesforce.com\Data Loader\bin
process.bat "C:\Users\abcdef\Desktop\CLIDataloader" AccountExtract

 
I am using data loader from command line but I'm getting one error when I'm trying to verify if my password generated is correct or not

Command: encrypt.bat -v generatedPassword secretKey

Error:
2016-05-24 08:29:52,056 ERROR [main] security.EncryptionUtil main (EncryptionUti
l.java:336) - Error decrypting string: 10d05e725ebd1999668536e79f4335e6, error:
Given final block not properly padded

Also how I can schedule data load and export from command line.

Thanks in advance
I have created one vf page which will show list of Campaign member based on particular condition in page block. In each campaign member I have one status field which I need to update. The Campaign member status values are depended on each and every Campaign which is parent of Campaign member. As of now I am getting all status value. I want to know how I can display relevant status value for each campaign member. below is my query:
 
List<CampaignMember> = [Select Contact.firstname,Campaign.name,campaign.status,
                         Contact.lastname,status
                         FROM CampaignMember LIMIT 1000];

 
I want to pass some value to a field that is not added to standard pagelayout using URL

As of now if that field is added to page layout then only I'm able to pass it else I'm not.

Thanks
I have one requirement where on click of Save button on event page it should remain in event detail page. As of now if we create event from any where like Account then after saving it, it will go back to previous page i.e. Account.

Any kind of help is highly appreciated. Thanks in advance
I want to update one record on click of javascript button, I am able to fetch record but not able to update that one. Below is my code:
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")} 

var myquery = "SELECT Field__c FROM Object WHERE Name = '1' limit 1"; 

result = sforce.connection.query(myquery); 
records = result.getArray("records"); 

if(records[0]){ 
var myObj = records[0]; 
} 

alert(myObj.Field__c); 
myObj.Field__c = 'Hello'; 
alert(myObj.Field__c); 

var results = sforce.connection.update([myObj]); 
alert(results);

 
How to know the date format of the user in salesforce. Basically I want to perform some operation based on user's date format.
Like:
If(date_format == dd/mm/yyyy) 
{ do this } 
if(date_format == mm/dd//yyyy) 
​{ do this }


I know we can use Map to store the locale as key and date format as values and then query the locale and get the date format, but it is very lengthy and it will also increase the no. of lines in code.
I am sending parameters in rturn url like below:
<apex:commandLink onclick="window.open('/{!list.Id}/e?retURL=apex/Mypage?id={!Event.Id}&{!parameter}')" value="Edit" id="edit"/>


after doing some action on standard page I want to return back to my vf page with some parameters but it is returning just one parameters not others like:
/apex/Mypage?id={!Event.Id}


but I need this url:
/apex/Mypage?id={!Event.Id}&{!parameter}'Here parameter is string

 
 
I have five string which contains some value I need to check if any of them contains value if yes then store them in Another string.

Currently I'm doing this like below:
List<string> slist = new List<string>();
String s1 = 'abc';
slist.add(s1);
string s2 = 'bcd';
slist.add(s2);
string s3 = 'cde';
slist.add(s3);
string s4 = 'def';
slist.add(s4);
string s5 = 'efg';
slist.add(s4);

string allstirng;
boolean check;
for(String s: slist){
    if(!check){
        allstirng +=',';
    }
    allstirng += s;
    check = false;
}

Is there any other better way of doing this.
 
I have one string variable which I need to pass for return url. I am not able to pass that in my url.
<apex:pageblockTable value="{!memList}" var="list" id="pbt1" >
    <apex:column headerValue="Edit" width="100px">
        <apex:commandLink onclick="window.open('/{!list.Id}/e?retURL={!Event.Id}')"  value="Edit"  id="edit" style="text-decoration:none;color:#3399CC;"/>
    </apex:column>
</apex:pageblockTable>
Controller:
public class ControllerExt(){
    public string passParameter;
    public ControllerExt(ApexPages.StandardController controller)
     {
        events = (Event)controller.getRecord();        
     }
}

Here passParameter is the string which I need to pass as url.


 
Site admins. Please delete my below post:

https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BMO8IAO
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BL38IAG
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BL33IAG
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BJXZIA4
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BIFEIA4
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BO2YIAW
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BOu7IAG
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BOrcIAG
I have two function which needs to be called from one button. Currently I am doing this by creating two button one "Confirm" and another "Save". but I don't want two button I want only one button "Save", on click of Save first the method called by "Confirm" button should be called and then the method called by "Save" button.

Below is my code:
 
<apex:commandButton value="Confirm" action="{!save}"/>   
<apex:commandButton value="Save" action="javascript:top.window.opener.closeFunction()" ></apex:commandbutton>

 
"The name can only contain underscores and alphanumeric characters. It must begin with a letter and be unique, and must not include spaces, end with an underscore, or contain two consecutive underscores. "

Basically what I'm trying to do is I am returning my selected records from custom lookup page to my base page. On click of save button it will close the opened lookup page and return the selected value to my base page.

I don't know what is the reason of this error.
 
<apex:commandButton value="Save" action="{!save},javascript:top.window.opener.closeLookup('conId','mess',thisPage:myForm:j_id28:myPgBlock:Con:targetName,thisPage:myForm:j_id28:myPgBlock:Con:targetId)" ></apex:commandbutton>

 
I have one VF page which has one field Name having default value of 'filled by trigger'. In the same page, I have one lookup field to object B. When we select this field and click on save button then our trigger will fire and it will update the Name value with the name of Selected record of object A.
I have checked the record created from vf page in standard page, where it is correctly displaying the field name, but when it comes to vf page it is not displaying the update name.
I am guessing this may be because of getter and setter.

VF Page:
 
<apex:page standardController="ObjectA" extensions="objectAController" >     
<apex:form >
   <apex:pageBlock title="ObjectA Edit" mode="edit">
   <apex:pageMessages /> 
        <apex:pageBlockButtons location="top">
            <apex:commandButton value="Save" action="{!save}" />
        </apex:pageBlockbuttons>   
        <apex:pageBlockSection title="ObjectA Name" columns="2" >
            <apex:inputField value="{!ObjectA__c.Name}" required="true"/>
        </apex:pageBlockSection>
        <apex:pageBlockSection title="Product Information">
            <apex:inputField value="{!ObjectA__c.Product2Id__c}" />
        </apex:pageBlockSection>        
    </apex:pageBlock>
    </apex:form>
</apex:page>

Controller:
 
public class objectAController {
  ApexPages.StandardController stdCtrl;

    public objectAController(ApexPages.StandardController controller)
     {  
     this.obj = (ObjectA)controller.getRecord();      
     obj.Name = 'Filled by Trigger';
     this.stdCtrl= controller;      
     }
 public PageReference save()
  {
      ObjectA__c objA =(ObjectA__c)stdCtrl.getRecord();
      try {
       upsert(objA);
        }
    catch(System.DMLException e) {
       ApexPages.addMessages(e);
     }
    return null;
  }
}

 
I have one custom event vf page which contains one lookup field Contact, On clicking of lookup icon on Contact it will open my custom lookup page. I am able to select multiple contact and saving them in one string. So on click of button I'm returning the selected contact in my base page, but while returning I'm getting following error. "The name can only contain underscores and alphanumeric characters. It must begin with a letter and be unique, and must not include spaces, end with an underscore, or contain two consecutive underscores."

Below is my Sample code:

Command Button:
<apex:commandButton value="Done" action="{!done},javascript:top.window.opener.contactLookup('{!FormTag}','{!TextBox}_lkid','{!TextBox}','{!contactId}','{!contactName}',false)" ></apex:commandbutton>

Here ContactId contains selected contact Id and ContactName contains selected contact Name, these two strings are returning value.

Method:
public String selectedContactName { get; set; }
public String contactId {get;set; } 
    public String getDone() {
        Boolean first = true;
        for ( SelectOption so : selectedContacts ) {
            if (!first) {
                selectedContactName += ', ';
                contactId += ', ';
            }
            if(first){
            selectedContactName = so.getLabel();
            contactId = so.getValue();
            }else{
            selectedContactName += so.getLabel();    
            contactId += so.getValue();
            }    
            first = false;
        }
        return selectedContactName ;

 
How to do pagination in salesforce using Querymore. In OrderItem object StandardSetController is not available and pagination using OFFSET returns only 2k records. So I'm thinking about doing this using Querymore method. If any other way is also possible than please let me know.

Thanks.
I need to show some generalised Error to user When I get some specific error.
The question is how to pass the caught Exception from Helper class to Trigger to show it to user and how to bulkify this.

Thanks
How to show results in a pageblock table dynamically.
I have two pageblock table on saving the first pageblock the result should show automatically in second pageblock.

Thanks
How can I add Summary Report without chart in a page layout?
As of now I am trying to create one VF page which I will add as inline VF page in layout, but the below code is not showing any results, its just showing white screen.

Thanks
<apex:page showHeader="false" sidebar="false">
  <apex:OutputPanel id="MissingAttRpt" >
        <apex:iframe src="/00Og000000hMj0h?isdtp=lt" scrolling="true"  height="1588px"  width="100%"/>   
  </apex:OutputPanel>
</apex:page>

 
I am sending parameters in rturn url like below:
<apex:commandLink onclick="window.open('/{!list.Id}/e?retURL=apex/Mypage?id={!Event.Id}&{!parameter}')" value="Edit" id="edit"/>


after doing some action on standard page I want to return back to my vf page with some parameters but it is returning just one parameters not others like:
/apex/Mypage?id={!Event.Id}


but I need this url:
/apex/Mypage?id={!Event.Id}&{!parameter}'Here parameter is string

 
I need to create a button on the account object that adds the users name to a custom field which is a lookup field to the user object. This field is similar to the account owner field
Hi,

Currently i am running into an issue while converting Leads to Accounts. The process runs fine as is. I have a requirement of changing a value on lead as the conversion is finished. I have looked at the Account After Update trigger and Lead after update trigger. Both are being called and executed on the LeadConvert process from salesforce. What i am trying to do is fetching the leadrecord based on the ConvertedAccountId on Lead it does not work anymore. Apperantly the field ConvertedAccountId on Lead is not being filled yet on execution of the triggers. I think the commit to the database is done later.

The execate situation. Based on the lead source we execute the LeadConvert ourselves or call a external URL (Olbico/D&B) with parameters which executes the leadConvert. In the last option i do not get a LeadConvertResult back. That is why i though i will have a look at the AfterUpdate triggers on Account and Lead but the moment they are executed the Convert Commit is not done yet. So no AccountId on lead.

Any suggestions, idea, concepts how to tackle this issue.

I have thought about mapping the Lead.Id to an Account Custom Field, through the default Fieldmapping. But this is not working as well because i cannot map the ID field in the mapping.

Best regards, Marcel


 
Hi All,

I'm not that good with writing codes and I need help on creating a trigger for a rollup summary (Lookup relationship). I have created this in flows but unfortunately, it doesn't work well if there is a huge amount of batch upload . Below are the details:

Sales Discount and FNR object are in look relationship

Sales Discount - Parent and below are fields that we need to pupulate the summarize value:
May A - Number field
May B - Number field
May C - Currency Field
June A - Number field
June B - Number field
June C - Currency Field
July A - Number field
July B - Number field
July C - Currency Field

Etc. until month of December



FNR Object - Child Object of Sales Discount


Months - Picklist field (may, june, july, until Dec.)
A - Number field
B - Number Field
C - Currency Field


Logic is. If (Picklist) months field is May and A, B, C, has a value, it will automatically summarize and be populated in the fields under Salesdiscount which is May A, May B, May C. Same logic with other months like june , july, until december. If the Fnr is deleted,  there's a recalculation of the summarize value as well.

Amy help will be much appreciated.

Thanks
Friends I am stuck in visualforce page with custo labels?
Label 1 "this is first label"
Label 2 "this is second label"
I want to use First Label in sirst line of page
after 10 output text 
I want to display second label 
How to do?
I am trying to integrate Salesforce via Boomi and as part of creating a PriceBookEntry I am unable to set the CurrrencyISOCode.  It always defaults to the currency of the user that is running the integration.  Our requirement is to be able to create price book entries in both the standard price book and custom price books in different currencies.

Has anyone been able to do this via the API?

Thanks

Hi All,

We are sharing account using sharing rules , manual sharing (record owner shares record) and apex sharing.

Is there any way to differentiate a record which is shared by manual sharing and apex sharing? 

In AccountShare object RowCause field for apex shared record also hold value as 'Manual' as default value.

Please help.

Regards

Ganesh

 

 

 

 

 

  • August 09, 2017
  • Like
  • 0
i am facing error when i  am trying to count the no of tasks(created by app) on lead object 
User-added image
what should be value of filed agreegate nad realtionship field . is it possible to count the tasks with the rollup helper.please help!

thanks in advance!
public class AP117ACTQualtrics {
   
   @future(callout=true)
   public static void basicAuthCallout(List<Id> IDs){
     
     HttpRequest req = new HttpRequest();
     list<contact> objCon=[select firstname,lastname,email from contact limit 2];
     string endPointUrl='https://eu.qualtrics.com/API/v3/mailinglists/ML_3l39rKNHuEOT0G1/contacts';
     endPointUrl=endPointUrl;
     req.setEndpoint(endPointUrl);
     req.setMethod('GET');
     String username = 'abc@xyz.com';
     String password = '********';
     Blob headerValue = Blob.valueOf(username + ':' + password);
     String authorizationHeader = 'BASIC ' +
     EncodingUtil.base64Encode(headerValue);
     req.setHeader('Authorization', authorizationHeader);
     req.setHeader('content-type','application/json');
     req.setHeader('accept-language','en-US');
     req.setHeader('X-API-TOKEN','w6I0GZXTo12345vyudn7cA8SFBGIXvUvQhXW');
     
     
     string strFname;
     String strLname;
     String strEmail;
     string extdataref;
     string Lang;
     string strEmbededData;
     Id contactId;
     CustomerComplaint__c objContact=[Select id,OwnerId,CustomerContactName__r.FirstName,CustomerContactName__r.LastName,CustomerContactName__r.Email,CustomerContactName__r.Language__c from CustomerComplaint__c where Id=:IDs Limit 1];
     if(objContact!=null){
     contactId=objContact.id;
     strFname='{"firstName": "'+objContact.CustomerContactName__r.FirstName+'",';
     strLname='"lastName": "'+objContact.CustomerContactName__r.LastName+'",';
     extdataref='"externalDataRef":"'+objContact.Id+'",';
     Lang='"language":"'+objContact.CustomerContactName__r.Language__c+'",';
     strEmbededData='"embeddedData": {"sfId": "'+objContact.id+'","sfOwnerId": "'+objContact.OwnerId+'","sfIsDeleted": "false"},';
     strEmail='"email": "'+objContact.CustomerContactName__r.Email+'"}';
     
     }
     string body=strFname+strLname+extdataref+Lang+strEmbededData+strEmail;
     system.debug('body........'+body);
     req.setBody(body);
     Http http = new Http();
     string strConId;
     HTTPResponse res = http.send(req);
     system.debug('res ..........'+res.getBody());
    FetchContactOrDistrId objContact1= new FetchContactOrDistrId();
     objContact1=parse(res.getBody());
     system.debug('objContact.............'+objContact1);
     if(objContact1!=null ){
     strConId=objContact1.Result.id;}
     system.debug('strConId.............'+strConId);
     
     HttpRequest reqDistribution = new HttpRequest();
     string endPointDisUrl='https://eu.qualtrics.com/API/v3/distributions';
     reqDistribution.setEndpoint(endPointDisUrl);
     reqDistribution.setMethod('POST');
     String bodyDis;
     String username1 = 'abc@xyz.com';
     String password1 = '*******';
     Blob headerValue1 = Blob.valueOf(username1 + ':' + password1);
     String authorizationHeader1 = 'BASIC ' +
     EncodingUtil.base64Encode(headerValue1);
     reqDistribution.setHeader('Authorization', authorizationHeader1);
     reqDistribution.setHeader('content-type','application/json');
     reqDistribution.setHeader('accept-language','en-US');
     reqDistribution.setHeader('X-API-TOKEN','w6I0GZXTo12345vyudn7cA8SFBGIXvUvQhXW');
     
     
     bodyDis='{"action": "CreateDistribution","surveyId": "SV_bgEnDhQebQgmtmZ","mailingListId": "ML_3l39rKNHuEOT0G1","description": "ACT Closing Survey List","expirationDate": "2017-12-03 11:22:33","linkType": "Individual"}';
    reqDistribution.setBody(bodyDis);
     Http httpRes = new Http();
     HTTPResponse result = httpRes.send(reqDistribution);
     
    FetchContactOrDistrId DisResult=parse(result.getBody());
    system.debug('DisResultD.............'+DisResult);
    String strDistId;
     if(DisResult!=null){
     strDistId=DisResult.Result.id;}
     
     system.debug('End Method'+strDistId);
     
     
     HttpRequest reqSurvey = new HttpRequest();
     string endPointSurveyUrl='https://eu.qualtrics.com/API/v3/distributions/'+strDistId+'/links?surveyId=SV_bgEnDhQebQgmtmZ';
     reqSurvey.setEndpoint(endPointSurveyUrl);
     reqSurvey.setMethod('GET');
     String bodyDis1;
     String username12 = 'abc@xyz.com';
     String password12 = '*******';
     Blob headerValue12 = Blob.valueOf(username12 + ':' + password12);
     String authorizationHeader12 = 'BASIC ' +
     EncodingUtil.base64Encode(headerValue12);
     reqSurvey.setHeader('Authorization', authorizationHeader12);
     reqSurvey.setHeader('content-type','application/json');
     reqSurvey.setHeader('accept-language','en-US');
     reqSurvey.setHeader('X-API-TOKEN','w6I0GZXTo12345vyudn7cA8SFBGIXvUvQhXW');
     Http httpResp = new Http();
     HTTPResponse resultRes = httpResp.send(reqSurvey);
     system.debug('lstElements.........'+resultRes.getBody());
     
     //string resSurveyLink=objSurvey.parse(resultRes.getBody(),strConId,contactId);
   
   QualtricsJSONparser.parse(resultRes.getBody(),strConId,contactId);
     //system.debug('resSurveyLink...........'+resSurveyLink);
  
     }
     
     
     /*Distrubtion list wrapper*/
  public class Elements {
    public String contactId;
    
    public String link;
       }
    public class Meta {
    public String httpStatus;
    public String requestId;
    public String notice;
    }

    public class FetchContactOrDistrId{
     public Meta meta;
    public Result result;
   
    }
    
    public class Result {
    public String id;
  
    }
    
   
    public static FetchContactOrDistrId parse(String json) {
        return (FetchContactOrDistrId) System.JSON.deserialize(json, FetchContactOrDistrId.class);
        }
}

 
I have the following task validation rule to prevent a text box from being populated unless a specific picklist value is specified. However, even if the text box is blank, the validation rule still fires and displays the error. Help!


AND(
NOT(ISPICKVAL(Status,"Completed")),
NOT(ISNULL(Description)))
  • November 02, 2016
  • Like
  • 0
I want to pass some value to a field that is not added to standard pagelayout using URL

As of now if that field is added to page layout then only I'm able to pass it else I'm not.

Thanks
I want to update one record on click of javascript button, I am able to fetch record but not able to update that one. Below is my code:
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")} 

var myquery = "SELECT Field__c FROM Object WHERE Name = '1' limit 1"; 

result = sforce.connection.query(myquery); 
records = result.getArray("records"); 

if(records[0]){ 
var myObj = records[0]; 
} 

alert(myObj.Field__c); 
myObj.Field__c = 'Hello'; 
alert(myObj.Field__c); 

var results = sforce.connection.update([myObj]); 
alert(results);

 
I have one VF page which has one field Name having default value of 'filled by trigger'. In the same page, I have one lookup field to object B. When we select this field and click on save button then our trigger will fire and it will update the Name value with the name of Selected record of object A.
I have checked the record created from vf page in standard page, where it is correctly displaying the field name, but when it comes to vf page it is not displaying the update name.
I am guessing this may be because of getter and setter.

VF Page:
 
<apex:page standardController="ObjectA" extensions="objectAController" >     
<apex:form >
   <apex:pageBlock title="ObjectA Edit" mode="edit">
   <apex:pageMessages /> 
        <apex:pageBlockButtons location="top">
            <apex:commandButton value="Save" action="{!save}" />
        </apex:pageBlockbuttons>   
        <apex:pageBlockSection title="ObjectA Name" columns="2" >
            <apex:inputField value="{!ObjectA__c.Name}" required="true"/>
        </apex:pageBlockSection>
        <apex:pageBlockSection title="Product Information">
            <apex:inputField value="{!ObjectA__c.Product2Id__c}" />
        </apex:pageBlockSection>        
    </apex:pageBlock>
    </apex:form>
</apex:page>

Controller:
 
public class objectAController {
  ApexPages.StandardController stdCtrl;

    public objectAController(ApexPages.StandardController controller)
     {  
     this.obj = (ObjectA)controller.getRecord();      
     obj.Name = 'Filled by Trigger';
     this.stdCtrl= controller;      
     }
 public PageReference save()
  {
      ObjectA__c objA =(ObjectA__c)stdCtrl.getRecord();
      try {
       upsert(objA);
        }
    catch(System.DMLException e) {
       ApexPages.addMessages(e);
     }
    return null;
  }
}

 
hi all,

I urgently need to edit/delete a post made by me on this discussion forum...But its not allowing me to do so and pops up
saying that 'you cant delete this question as others are interested in it'.
There are no likes and no comments on it still i am unable  to delete it
Any help would be highly appreciated

Its very urgent,
Thanks,