• Abhishek_New
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 10
    Replies

I have different levels

1.Apex:page

2.form

3.pageblock

3.pageblocksection

4.inputfield

 

Every level has their ids.Now in JScript I want to traverse through ids by document.getElementById....how to traverse ?Directly using .inputfield id is not working,,,,,Suggestion please!

I have different levels

1.Apex:page

2.form

3.pageblock

3.pageblocksection

4.inputfield

 

Every level has their ids.Now in JScript I want to traverse through ids by document.getElementById....how to traverse ?

I have a lookup field in my VF page which can populate data from its Master object to its child record.Now after I select the Master record in Lookup, I need to show the data in a Alert msg which will popup while clicking the save button ,"before saving the data".Currently it is showing null. As the record is not populated yet in child record.How to proceed ..Anyone Pls help!

I have created a customer registration form on Customer object(custom).I am able to save data while using pages...but while using sites  data is not getting saved..

 

Error :Authorization Required

You must first log in or register before accessing this page.                 
If you have forgotten your password, click Forgot Password to reset it.   

 

In Debug log:

25.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
06:56:56.184 (184988000)|EXECUTION_STARTED
06:56:56.185 (185028000)|CODE_UNIT_STARTED|[EXTERNAL]|06690000001XVeY|VF: /apex/Unauthorized
06:56:56.067 (200281000)|CUMULATIVE_LIMIT_USAGE
06:56:56.067|CUMULATIVE_LIMIT_USAGE_END

06:56:56.200 (200306000)|CODE_UNIT_FINISHED|VF: /apex/Unauthorized
06:56:56.200 (200320000)|EXECUTION_FINISHED

 

I have given permission in candidate object.

 

in public Access Settings-->perticular profile-->Custom Object Permissions-->read/create/edit/delete/view all/modify all to the candidate object.all access I have given.Still getting the authorisation error while saving data..

              

I have my Custom object candidate within which a pickilist is there named "Education".Now I want to create a customer registration form in visual force..How I can do it? I have tried the following way:

Visual force:

 

<apex:page controller="Candidate"  >
<apex:pageBlock title="Candidate Registration">
<apex:form >
<apex:pageBlockSection >

<apex:selectList label="Education" value="{!Education}">  

<apex:selectOptions value="{!statusOptions}" /> </apex:selectList>

</apex:pageBlockSection>

</apex:form>

</apex:pageBlock>

</apex:page>

 

controller Apex:

 

public with sharing class Candidate {

    public List<SelectOption> statusOptions { get;set; }        

   

???? How to get the PICKLIST values????

 

    public String Education {get;set;}

                                                           }

 

 Please help ..I am new to Salesforce domain....

 

map<id,case> caseLst =new map<id,case>([select id,AccountId,status from case where Accountid=:mp.keyset()]);

here mp.keyset() contains several Accountids that the cases are related to.

 

now my question is will the above MAP's key always contain the ids of case ? Is there any way so that I can keep AccountId field of a case object as a key of the MAP when populated through SELECT statement ?

 

I tried to give--

map<String,case> caseLst =new map<String,case>([select AccountId,status from case where Accountid=:mp.keyset()]);

 

But then also caseLst.keyset() contains only ids of the case records not the AccountIds.

 
trigger UpdateContactNo on Contact (after insert) { list<Account> acc = new list<Account>();        
for(Contact c:trigger.new)
{ 
  list<Account> ac =[select id,No_of_Contacts__c from Account where id =: c.AccountId]; 
    for(Account a : ac)
           {
               if (a.No_of_Contacts__c != null){   
             a.No_of_Contacts__c = a.No_of_Contacts__c+1;
                    acc.add(a); 
              }
             else{
                a.No_of_Contacts__c = 1;
                    acc.add(a); 
              }
       } 
}
try
{
   if(!acc.isEmpty)
    update acc;
}
catch(Exception e)
{
e.getMessage();
}

}
Error is coming in if (a.No_of_Contacts__c != null)line...

I tried to write my first apex code....

 

public with sharing class HelloWorldPositionClass

{

public static void HelloWorld(position__c[] positions)

{

for(position__c[] p:positions)

{

if (p.Hello__c = null || p.Hello__c != 'world')

p.Hello__c ='World';-->Error*

}

}

}

 

Iam getting the error while saving--Save error: Initial term of field expression must be a concrete SObject: LIST<position__c>  what does it mean ? how to solve?

Hello all,

 

As per the documentation provided here (http://wiki.developerforce.com/page/Digging_Deeper_into_OAuth_2.0_on_Force.com), I am trying to understand how OAuth works for salesforce authentication. 

 

What I have done so far: (I have client id and secret from a remote app)

 

1. Created a Sites VF Page which has a button that redirects to the salesforce authentication page (https://login.salesforce.com/services/oauth2/authorize?response_type=code&client_id=<your_client_id>&redirect_uri=<your_redirect_uri>)

 

2. This gives me a CODE on the redirecturi page, from here I call the  'https://login.salesforce.com/services/oauth2/token' service passing all the required params, this gives me a access_token.

 

3. I have a Apex REST class, this is where I am not able to proceed. When I try to hit this url, I get an error response that says "This session is not valid for use with the REST API". I am also passing the "Authorization" header in the request.

 

I need someone to tell me what am I doing wrong? And the implementation done so far is correct or it needs to be changed?

map<id,case> caseLst =new map<id,case>([select id,AccountId,status from case where Accountid=:mp.keyset()]);

here mp.keyset() contains several Accountids that the cases are related to.

 

now my question is will the above MAP's key always contain the ids of case ? Is there any way so that I can keep AccountId field of a case object as a key of the MAP when populated through SELECT statement ?

 

I tried to give--

map<String,case> caseLst =new map<String,case>([select AccountId,status from case where Accountid=:mp.keyset()]);

 

But then also caseLst.keyset() contains only ids of the case records not the AccountIds.

Hi,

 

How to put merge fields in excel sheet?

 

 

Thank you

Pretty new to this and hoping somebody can help... 

 

I want to have a controller do some calculations for me. 

 

for example, I want to return a weighting %  based on age of the opportunity. 

 

I have defined the age as such: 

 public integer getAge() {
        if(opp.isClosed == false) 
return Date.valueof(opp.CreatedDate).daysBetween(date.today());
return Date.valueof(opp.CreatedDate).daysbetween(opp.CloseDate); }

 

However, I now want to build a decimal based on that, but cant seem to be able to access the Age value that I just created even thought it is public. 

 

decimal weight = if(age<10)
{.10;}else{.30;}

 Does not work as it appears I cant use an if statment to define a variable. I get the error Expression cannot be a statement. 

 

What is the proper way to do this? 

 

Hi All 

 

I need to send a request to another URL

This is my request 

endpoint = 'http://api.icentera.com/v1/TestService.svc/json/SearchDocumentsForSF?token='+tokenval+'&search=&sfValues=Industry__c:'+o.Industry__c+'&page=1';

 

Industry__c is a pick list field which will return values like "Public Safety"

But it should go as "Public+Safety" in the above URL.

How can we make my picklist field value incorporate "+sign" in the space.?

 

Thanks in advance

 
trigger UpdateContactNo on Contact (after insert) { list<Account> acc = new list<Account>();        
for(Contact c:trigger.new)
{ 
  list<Account> ac =[select id,No_of_Contacts__c from Account where id =: c.AccountId]; 
    for(Account a : ac)
           {
               if (a.No_of_Contacts__c != null){   
             a.No_of_Contacts__c = a.No_of_Contacts__c+1;
                    acc.add(a); 
              }
             else{
                a.No_of_Contacts__c = 1;
                    acc.add(a); 
              }
       } 
}
try
{
   if(!acc.isEmpty)
    update acc;
}
catch(Exception e)
{
e.getMessage();
}

}
Error is coming in if (a.No_of_Contacts__c != null)line...

Hello, 

I am new to APex code and recently I wrote basic triggers.Now I started working on SOQL but am not sure how to start the syntax.

Suppose I have two object Account and Opportunities and I hav a field 'Count_ops' on Account which take the count of Opps and I want to update the field whenever new opportunity is created on this account.

So how to write trigger for it using sosql?

I tried this way:

 

trigger counts on Account (before insert) {
Account acc=trigger.new[];
count_opps=[selct count() of Opportunity where account.id=opportunity.id];

}

 

Please help me to understand the syntax......

 

 

Also I have seen that people uses list and sets to store data of query, when and why to use that? I am so confused  :(

I tried to write my first apex code....

 

public with sharing class HelloWorldPositionClass

{

public static void HelloWorld(position__c[] positions)

{

for(position__c[] p:positions)

{

if (p.Hello__c = null || p.Hello__c != 'world')

p.Hello__c ='World';-->Error*

}

}

}

 

Iam getting the error while saving--Save error: Initial term of field expression must be a concrete SObject: LIST<position__c>  what does it mean ? how to solve?