• om gupta(sfdc)
  • NEWBIE
  • 5 Points
  • Member since 2015


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 32
    Replies
hi,
    i have successfully created my custom domain in salesforce the following step i have followed .
    1)Create CNAME in godday for example  CNAME   support     support.mycustom.com.[orgid].live.siteforce.com   
    2)create a domain name in salesforce support.mycustom.com
    3)Created a custom url support.mycustom.com  / sitename  (https://mysite.secure.force.com)
    issue is that when i type support.mycustom.com in the url it forwarded to https://mysite.secure.force.com (thats great :))  but it not showing my custom domain url that is support.mycustom.com it showing https://mysite.secure.force.com that i have not to show. i have to show my support.mycustom.com that url only.

thanks
om gupta

    
Hi -- I have one xyz custom object and which is related with account object now i have req where on account object there will be 3 or 4 xyz object records and i want to create a new fields which is called first record and latest record checkbox which is based on created date of xyz records how will i achieve ??
for example :: on account there will be xyz object has a , b , c records based on creation date it will checked a record first records box true and same with the latest one ?????
Hey, team, 
I m Facing issue with the below mentioned Bold point.
Please help.


• Create a custom checkbox field on Account and name it ‘Create Contact?’
• Create a number field on Account and name it as ‘No. Of Contacts to create’.
• Create an autonumber field on Account name it as “Account Number”.
• Create a custom number field on Contact and name it as “Contact Count”.
• Each time an account record is saved with checkbox marked as true; with a given number value, that many contact records should be created with following actions
o LastName = Account Number - Contact Count
o FirstName = Account Name
o Phone = Phone
o Billing Address = Billing Address
o Shipping Address = Shipping Address
o Contact Count = which number of contact this is with respect to Account. So for example Account ‘Acme’ already had 5 Contacts and you are creating 6th Contact it should say Contact Count as 6th, 7th etc.
public class AccountAutomation 
{

    public void contactHandler(List<Account> AccList)
    {
    try{
    List<Contact> ConList = new List<Contact>();
    map<id,decimal> AccMap=new map<id,decimal>(); 
       
        for(Account Acc : AccList)
        {
            if(Acc.Create_Contact__c == true)
            {
                
            	AccMAp.put(Acc.id, Acc.No_Of_Contacts_to_create__c);
             	if(Accmap.size()>0 && Accmap!=Null)
                {
                    for(ID AccID : AccMap.keySet())
                    {
                       for(integer i = 0;i<AccMap.get(Accid);i++) 
                       {
                           Contact Con = new Contact();
                           Con.accountId         = Accid;
                           Con.LastName          = Acc.Account_Number__c + '-' + con.Contact_Count__c;
                           Con.FirstName                     = Acc.Name;
                           Con.Phone	                        = Acc.Phone;
                           con.MailingStreet                 =acc.BillingStreet;
               			   con.MailingCity             =acc.BillingCity;
                		   con.MailingState           =acc.BillingState;
                		   con.MailingPostalCode =acc.BillingPostalCode;
                		   con.MailingCountry       =acc.BillingCountry;
                          
                           ConList.add(Con);
                       }
              
                    }
                }
                if(ConList.Size()>0 && ConList!=Null)
                insert ConList;
                
                
            }
        }
        
    }
         catch (Exception e)
        {
            system.debug('An Exception has occured = '+e);
        }

}
}

 
Hello.
I want create multiple visualforce pages that pull in specific records for the user that is logged into Salesforce.
I know I can grab the List for each object like this:
<apex:page standardController="Account" recordSetvar="accounts">
    <apex:pageBlock >
        <apex:form id="theForm">
            <apex:panelGrid columns="3">
                <apex:outputLabel value="View:"/>
                <apex:selectList value="{!filterId}" size="1">
                    <apex:actionSupport event="onchange" rerender="list"/>
                    <apex:selectOptions value="{!listviewoptions}"/>
                </apex:selectList>
            </apex:panelGrid>
            <apex:pageBlockSection >
                <apex:dataList var="c" value="{!accounts}" id="list">
                {!c.Name}
                {!c.Tier__c}
                </apex:dataList>
            </apex:pageBlockSection>
        </apex:form>
    </apex:pageBlock>
</apex:page>
But this wil lshow all of the Accounts.  Can I show the the records for just the specific user that is logged in?
Also, can I make the Name field a link field to open to the details page when clicked?

Thanks,
M
 
I've created a custom domain for my Salesforce Visualforce page and when I type in  http://enquiry.dacs.org.uk into my browser it goes to https://dacs.secure.force.com/enquiry.

However I'm wanting it to show the page the original URL in the browser (http://enquiry.dacs.org.uk) even though it is displaying the page https://dacs.secure.force.com/enquiry. 

How do I do this?
 
I'm a trying to put together a simple query that will create an email list from a list of about 30 account id's. So, basically looking to select email from contact where account ID = xxx, yyy, zzz 

Thanks!
Error: Compile Error: Variable does not exist: ParentId at line 163 column 19
global with sharing class RelatedList{
@RemoteAction
    global static String insert_Note_Row()
     {
         Note n = new Note();
               try {               
                n.ParentId='a017F0000015hib';
                n.Body='she is ok';
                n.Title='New Note';
                insert n;
            } catch (DmlException e) {
            }            
        return('insert note successfull');                           
     }            
}
I am calling a class that is using tooling API to update validation rule from BATCH CLASS.
I am getting user session id as null.

        req.setHeader('Authorization','Bearer '+UserInfo.getSessionID());   // here iam getting null
         req.setHeader('Content-Type', 'application/json');
         req.setHeader('Content-Length', '0');

and when i run class from developer console , all works fine.
Please let me know how to fix this ?
Thanks
Hi Everyone,

I am trying to invoke  an apex  from a java class which takes in a parameter using the salesforce REST api . I already have the logic to retrive the access token via oAuth but not sure  but i m not  sure how i should pass the parameters value via the REST call and also invoke the execute() .

I execute this APEX in the Salesforce developer console (Anonymous Window) as follows : 

ApexClass apexClass = new ApexClass('param', false); 
Database.executeBatch(apexClass, 100);

Now I need to execute the same block form my java code.

Any help is highly appreciated!
 
I'm writing a trigger to default the Account of a Contact each time a Contact is created.  The trigger is relatively simple.  I'm receiving an error that reads: Variable does not exist: Id.  Can anyone point me in the direction of what I'm doing wrong?
 
trigger setDefaultAcc on Contact (before insert){
    List<Contact> lstCon = new List<Contact>();
    // Find out and prepare list of Contacts
    for(Contact var : Trigger.new){
        if(var.AccountId == null){
            lstCon.add(var);
        }
    }
    // Fetch the Default account
    if(lstCon.size()>0){
        List<Account> acc = new List<Account>();
        acc = [SELECT Id, Name FROM Account WHERE Name = 'Strategic Market Advisors' LIMIT 1];
        if(acc != null){
            for(Contact var : lstCon){
                // Assign the id of the default account to the selected contacts
                var.AccountId = acc.Id;
            }
        }
    }
}

 

I am trying to retrieve data from salesforce using the REST api and CURL in PHP.

I perform the authentication request and recieve an 'instance_url' and 'access_token' but after performing a query request using those, i receive an "INVALID_SESSION_ID" error.

my authentication request code:

function get_sf_auth_data() {

	$post_data = array(
        'grant_type'    => 'password',
        'client_id'     => 'xxxxxxxxxxxxxxxxxxxxxx', //My client id (xxx... for this example)
        'client_secret' => '111111111111', // My client secret (111... for this example)
        'username'      => 'my_user_name',
        'password'      => 'my_user_password'
	);
	
	$headers = array(
    	'Content-type' => 'application/x-www-form-urlencoded;charset=UTF-8'
	);

	$curl = curl_init('https://login.salesforce.com/services/oauth2/token');
	curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($curl, CURLOPT_POST, true);
	curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);

	$response = curl_exec($curl);
	curl_close($curl);

    // Retrieve and parse response body
    $sf_access_data = json_decode($response, true);
    
    echo '*********' . $sf_response_data['instance_url'] . '********';
    echo '*********' . $sf_response_data['access_token'] . '********';

    return $sf_access_data;
}
My query request code:
function get_user_sfid($sf_access_data, $user_id_number){

	$sql = "SELECT Id, Name 
			FROM Account 
			WHERE ID__c = '$user_id_number'";

	$url = $sf_access_data['instance_url'] . '/services/data/v20.0/query/?q=' . urlencode($sql);

	$headers = array(
		'Authorization' => 'OAuth ' . $sf_access_data['access_token']
	);

	$curl = curl_init($url);
	curl_setopt($curl, CURLOPT_HEADER, false);
	curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);

	$json_response = curl_exec($curl);
	curl_close($curl);

	var_dump($json_response); // This prints out the response where i got the error

	$response = json_decode($json_response);

	return $response['id'];
}
The response to the query request as is:
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]
I have also tried using this guide (http://developer.force.com/cookbook/recipe/interact-with-the-forcecom-rest-api-from-php) as refrence but it uses an "authorization_code" authentication and not a password one.