• Vamsi Krishna
  • SMARTIE
  • 968 Points
  • Member since 2013
  • Coder.. Decoder..


  • Chatter
    Feed
  • 32
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 162
    Replies
Hi folks,
    Can anyone tell me what is REST API and how to excute REST API in salesforce

Thanks in advance
Karthick
Hi,

I'm trying to mimic a workflow field update from the Campaign Member to the Campaign (as it cannot be done via a workflow). What I want is when a picklist (Send_tutor_details_to_client__c) is updated to 'First', the contents of another field on the Campaign Member (Tutor_details_for_email__c) are copied to a corresponding field on the Campaign (Tutor_1__c).

I'm getting an error about sObjects, however, that I don't understand.

This is the trigger:

trigger UpdateTutor1onCampaign on CampaignMember (after insert, after update) {

  Map<ID, Campaign> parentCams = new Map<ID, Campaign>();
  List<Id> listIds = new List<Id>();

  for (CampaignMember childObj : Trigger.new) {
    listIds.add(childObj.Campaign);
  }

       parentCams = new Map<Id, Campaign>([SELECT id, Tutor_1__c Name,(SELECT ID, Send_tutor_details_to_client__c FROM CampaignMember) FROM Campaign WHERE ID IN :listIds]);

  for (CampaignMember childObj: Trigger:new){
     Campaign myParentCams = parentCams.get(childObj.Campaign);
     myParentCams.Tutor_1__c = childObj.Send_tutor_details_to_client__c;
  }

  update parentCams.values();
}

And this is the error:

sObject type 'Interview_Date_Time_Confirmed__c' 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.

Any help would be very welcome, thanks!

2 standard Object: Account and User

1. there's a customer field in Account : Public_Owner__c, it's a lookup field(User) 
2. there's a customer field in Account : isPublic(bool)
3. there's a rule in field Public_Owner : ((Public_Owner_r.LastName != null) && (isPublic=true) )
     error message is : "it's not allowed to check isPublic when Public_Owner is not null"
means: if Public_Owner == null then isPublic = true else isPublic = false;

my program(C#):
......
accounts[0].Id = id;
accounts[0].Public_Owner__c = userId
accounts[0].isPublic = (userId == null) ? true : false;

LimitInfo[] li;
SaveResult[] sr;
DebuggingInfo di = client.update(header, null, null, null, null, null, null, null, null, null, null, accounts, out li, out sr);
if (sr[0].success == false)
 {
      foreach (Error error in sr[0].errors)
            {
                returnValue += "errormessage:" + error.statusCode + error.message + "\t";
            }
}

here's the problem:
when I call update() to update the account,  if field isPublic is false,update() is OK,else there's always a error: FIELD_CUSTOM_VALIDATION_EXCEPTION and the rule error:"it's not allowed to check isPublic when Public_Owner is not null"

sorry for my poor english,could anybody help me?
Thanx!
I want to have latest values after clicking "Remove interest".. Code is working perfectly but I am able to see only after refreshing on my own

My vf page is:

<apex:page standardController="Aspirant__c" extensions="displayRelatedlists">
<apex:form >
<apex:pageBlock id="blk">
<apex:pageBlockTable value="{!prsns}" var="pr">
<apex:column value="{!pr.Name__c}" />
<apex:column >
<apex:facet name="header">Remove Interest</apex:facet>
<apex:commandLink value="Remove Interest" action="{!removeInterest}" reRender="blk" >
<apex:param assignTo="{!aspId}" name="aspId" value="{!pr.Id}" />
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>


apex class:

public class displayRelatedlists{
public ApexPages.StandardController controller{get;set;}
public Aspirant__c asps{get;set;}
public List<Interested_Persons__c> prsns{get;set;}
public String aspId{get;set;}
public displayRelatedlists(ApexPages.StandardController controller)
{
this.controller = controller;
this.asps= (Aspirant__c)controller.getRecord();
this.prsns = [SELECT Name__c from Interested_Persons__c where Interested_To__c=:asps.Id];
}
public PageReference removeInterest()
{
system.debug('++++++++++++++++++++ '+aspId);
Interested_Persons__c ipc = [select Id,Name__c from Interested_Persons__c where Id=:aspId];
delete ipc;
return null;
}

}
I have the URL:

URL= https://c.eu0.visual.force.com/apex/BBBBPg?mailPG2=popopopopop&minutePG2=00&nomJobPG2=MARIEEE&requetePG2=po

I would like to display the parameter nomJobPG2 into my inputText....
Is it possible???

OUTPUT TEXT --> IT WORK
<apex:outputText value="{!$CurrentPage.parameters.nomJobPG2}" id="nomJobOP" /><br />
    
    INPUT TEXT --> IT NOT WORK
Job Name.:&nbsp;<apex:inputText id="nomJobIP" value="{!nomJob}" /><br /><br />

* nomJob: variable into Apex class
global String nomJob{get;set;}

Thank you
Can anyone tell what is the relationship between all standard slaesforce objects and give me the uml diagram for those objects

Thanks in advance,
Karthick
Hi,
              Here object name through URL will come look like

https://Raju.ap1.visual.force.com/apex/Dynamicsetpage?DFN=ramobj
In My apex class i get this objects as using schema method and i displayed all fields

strtemp=ApexPages.currentPage().getParameters().get('DFN');
  
    this.DFN=strtemp;

     system.debug('*********objectselected//**********'+strtemp);
     String strFieldName = 'raju__'+DFN + '__c'; //Object name
       system.debug('*********objects**********'+strtemp);

My Question:How to give save functonality of this Dyamically getting object?

help me..........

 Hi,

I am trying to create this graph in APEX. I am getting an error "Illegal assignment from LIST<Account> to LIST<XXX.Sample.RadarWedgeData>". Is this most likely because of a integer vs. number data type problem, a lack of data, or something else? Thanks
 

public class Sample {
    List<String> xx = new List<String> {'Planning','Management','Tax','Risk','Liability'};
    
    public class RadarWedgeData {
public Integer data1 { get; set; }
public Integer data2 { get; set; }
public Integer data3 { get; set; }


public RadarWedgeData(Integer data1 , Integer data2,Integer data3) {
this.data1 = data1;
this.data2 = data2;
this.data3 = data3;
}
}
    
    public List<RadarWedgeData> getData(){
          List<RadarWedgeData> memList = new List<RadarWedgeData>();
           memList = [SELECT test1__c, test2__c, test3__c from Account where ID = '001F0000018glHz'];
           for (Account mem: memList){              
               data.add(new RadarWedgeData(mem.test1__c, mem.test2__c, mem.test3__C));
        }
}
}


 

Hi all,

I am attempting to build a radar chart based off of this (https://github.com/developerforce/Visualforce-Charting-Examples" rel="nofollow) github page :

I've created the Account field set and included my three test variables in the field set. I've barely touched the base code yet, but I'm getting an error message when trying to preview the page. "System.QueryException: invalid ID field: null. Class.XXX.RadarChartController.getData: line 28, column 1"

Apex page code:

<apex:page standardController="Account" extensions="RadarChartController">  
<style>
    #vfext4-ext-gen1026 {
        width:800px !important;
    }
</style>  

<apex:chart name="myChart" height="600" width="650" legend="false" data="{!data}">
            <apex:legend position="left" />
            <apex:axis type="Radial" position="radial"/>
            <apex:radarSeries title="Customer Satisfaction" xField="field" yField="value" tips="true" opacity="0.4"/>
      </apex:chart>
</apex:page


Apex class code


public class RadarChartController {
public List<Map<Object,Object>> data = new List<Map<Object,Object>>();
public String acctId {get;set;}


public RadarChartController(ApexPages.StandardController controller){
    acctId = controller.getRecord().Id; //'001x00000035SrC';
}


public List<Schema.FieldSetMember> getFields() {
    return SObjectType.Account.FieldSets.RadarSet.getFields();
}


public List<Map<Object,Object>> getData() {
    String query = 'SELECT ';
    List<String> fieldNames = new List<String>();


    for(Schema.FieldSetMember f : getFields()){
        query += f.getFieldPath() + ', ';
        fieldNames.add(f.getFieldPath());
    }
    query += 'Id, Name FROM Account where Id=\'' + acctId + '\' LIMIT 1';


    SObject myFieldResults = Database.Query(query);
    Schema.DescribeSObjectResult R = myFieldResults.getSObjectType().getDescribe();
    Map<String, Schema.SObjectField> fieldMap = R.fields.getmap();


    //creates a map of labels and api names
    Map<String,String> labelNameMap = new Map<String,String>();
    for(String key : fieldMap.keySet()){
         labelNameMap.put(fieldMap.get(key).getDescribe().getName(), fieldMap.get(key).getDescribe().getlabel());
    }


    //creates a map of labels and values
    for(String f : fieldNames){
        String fieldLabel = labelNameMap.get(f);
        String fieldValue = String.valueOf(myFieldResults.get(f));


        Map<Object, Object> m = new Map<Object,Object>();
        m.put('field', fieldLabel);
        m.put('value', fieldValue);
        data.add(m);
    }


    return data;
}
}


Never done much in Apex before, and this has me stuck. I changed line 25 in the controller code to make the query look for a specific account ID, but that didn't fix the problem. Any ideas?

Thanks!

// i am trying to use the jquery in visualforce but it's not working .
i tried both method by using the static resource and by using the CDN file also but no one is working
can anyone tell where i am doing the mistake?


<apex:page >
<apex:includeScript value="{!URLFOR($Resource.jqueryui,'jqueryui/js/jquery-1.10.2.js')}"/>
<apex:includeScript value="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"/>
<head>
<script>
J$ = jQuery.noConflict();
J$(document).ready(function(){
alert("hello jQuery");
)};
</script>
</head>
<apex:pageBlock >
hello
</apex:pageBlock>
</apex:page>

// i am trying to use the jquery in visualforce but it's not working . 
i tried both method by using the static resource and by using the CDN file also but no one is working 
can anyone tell where i am doing the emistake?
I want to concatenate two strings to for the query to be executed using Database.Query. Here is what i am doing
string sql1 = 'Select Custom_Name__c from Opportunity  where AccountId IN';
string2 sql2= '(Select Id from Account where Europe__c =True)';
Opp=Database.query(sql1+sql2);
sysem.debug(Opp);
Doesn't work.Any Ideas?
Hi Experts,

We are facing one issue with the record type. The problem is the record type selection page is not displaying for the user after clicking "New" button for task object.

At profile level we given permission for the record types for Task object but still not able to see those record type after clicking "New" button for task object.

For the other users with the same profile, they all are able to see the record type selection page except for one user.

Looking forward for your valuble ideas on this.

Regards,
Priya
  • June 03, 2014
  • Like
  • 0
I have a doubt regarding apex develompent in a professional edition.
I know that apex isn't available with this license, however in this (http://www.salesforce.com/us/developer/docs/packagingGuide/Content/dev_packages_apex_ge_pe.htm) page is written that i can use apex for web services callouts:
Using Apex to make Web service callouts is allowed in GE/PE. For instance, if you’re planning to make a Web service callout to an external Web service, as long as the managed package is authorized, these classes will function in GE/PE.
In my project I need to retrieve data from an external web service and show them in salesforce. Is this possibile in a professional edition with apex? In particular I would like to create a custom controller, that will retrieve the data from external web service, and attach it to a visualforce page to show the data retrieved.
If I cannot use apex I'll create a simple visualforce page and then load the data from the external web service through jQuery.

 
Hi,

  I created a validation using javascript  as mentioned below. I am calling this function on a button click as shown below.

    Problem I am facing is function action="{!processSelected}"is getting called even if validation is throwing a alert message.

  How to add condition action="{!processSelected}" must be called only if validation is passed.  Please suggest.

Visual Force Button 
<apex:pageBlockButtons id="reportbutton">
       <apex:commandButton value="Save Records" action="{!processSelected}" onclick="Opportunity_Validation()"/>      
       </apex:pageBlockButtons>


Javascript
<script type="text/javascript">
function Opportunity_Validation()
{
  var val = document.getElementById('{!$Component.RenewalForm.configblock.configsecblock.confignewopp.newopp}').value; 
  var oval = document.getElementById('{!$Component.RenewalForm.configblock.configsecblock.configopport.existopp}').value; 
   if ( val == '' && oval == '') {
    alert('Enter Opportunity Details');
    }
    else if ( val != '' && oval != '') {
     alert('Enter either existing opportunity or new opporutnity');
     }
  }
</script>

Thanks
Sudhir
I use apex:repeat to build the rows of a table. The table is inside a apex:pageBlockSection. SFDC adds an extra row/td and messes up my table. See below. Notice the <td class="dataCol  last " colSpan="2"> in the output.

Does anyone know of a work around?

My VF code:
<apex:pageBlockSection title="Section 1: Summary Color Codes" columns="1">
        <table width="100%" border="1" cellpadding="0" cellspacing="0">
            <tr>
                <th></th>
                <th>Total</th>
                <th>% of Total</th>
                <th>US</th>
                <th>EU</th>
            </tr>
            <tr style="font-weight: bold;">
                <td colspan="5">Product Profile</td>
            </tr>
            <apex:repeat value="{!PGStatCurrStrList}" var="pg">
                <tr>
                    <td>&nbsp;&nbsp;&nbsp;{!pg['Label']}</td>
                    <td>{!pg['Total']}</td>
                    <td>{!pg['%']}</td>
                    <td>{!pg['US']}</td>
                    <td>{!pg['EU']}</td>
                </tr>
            </apex:repeat>
        </table>
    </apex:pageBlockSection>

Page source shows this:
<div id="j_id0:j_id1:j_id6"><div class="pbSubheader brandTertiaryBgr first tertiaryPalette"><img src="/s.gif" alt="Hide Section - Section 1: Summary Color Codes"  class="hideListButton" id="img_j_id0:j_id1:j_id6" name="Section 1: Summary Color Codes" onclick="twistSection(this);" onkeypress="if (event.keyCode=='13')twistSection(this);" style="cursor:pointer;" tabindex="0" title="Hide Section - Section 1: Summary Color Codes"/><h3>Section 1: Summary Color Codes</h3></div><div class="pbSubsection"><table class="detailList" border="0" cellpadding="0" cellspacing="0"><tr><td class="dataCol  first " colSpan="2">
  <table border="1" cellpadding="0" cellspacing="0" width="100%">
   <tr>
    <th></th>
    <th>Total</th>
    <th>% of Total</th>
    <th>US</th>
    <th>EU</th>
   </tr>
   <tr style="font-weight: bold;">
    <td colspan="5">Product Profile</td>
   </tr></td><td class="dataCol  first " colSpan="2">
    <tr>
     <td>&nbsp;&nbsp;&nbsp;Dark Fiber</td>
     <td>USD 0.00</td>
     <td>0%</td>
     <td>USD 0.00</td>
     <td>USD 0.00</td>
    </tr></td></tr><tr><td class="dataCol " colSpan="2">
    <tr>
     <td>&nbsp;&nbsp;&nbsp;Ethernet</td>
     <td>USD 123.00</td>
     <td>40%</td>
     <td>USD 123.00</td>
     <td>USD 0.00</td>
    </tr></td><td class="dataCol " colSpan="2">
    <tr>
     <td>&nbsp;&nbsp;&nbsp;FTT</td>
     <td>USD 182.16</td>
     <td>60%</td>
     <td>USD 182.16</td>
     <td>USD 0.00</td>
    </tr></td></tr><tr><td class="dataCol " colSpan="2">
    <tr>
     <td>&nbsp;&nbsp;&nbsp;IP Services</td>
     <td>USD 0.00</td>
     <td>0%</td>
     <td>USD 0.00</td>
     <td>USD 0.00</td>
    </tr></td><td class="dataCol " colSpan="2">
    <tr>
     <td>&nbsp;&nbsp;&nbsp;SONET</td>
     <td>USD 0.00</td>
     <td>0%</td>
     <td>USD 0.00</td>
     <td>USD 0.00</td>
    </tr></td></tr><tr><td class="dataCol " colSpan="2">
    <tr>
     <td>&nbsp;&nbsp;&nbsp;Wavelengths</td>
     <td>USD 0.00</td>
     <td>0%</td>
     <td>USD 0.00</td>
     <td>USD 0.00</td>
    </tr></td><td class="dataCol " colSpan="2">
    <tr>
     <td>&nbsp;&nbsp;&nbsp;zColo</td>
     <td>USD 0.00</td>
     <td>0%</td>
     <td>USD 0.00</td>
     <td>USD 0.00</td>
    </tr></td></tr><tr><td class="dataCol  last " colSpan="2">
    <tr>
     <td>&nbsp;&nbsp;&nbsp;zTech</td>
     <td>USD 0.00</td>
     <td>0%</td>
     <td>USD 0.00</td>
     <td>USD 0.00</td>
    </tr></td><td class="dataCol  last " colSpan="2">
  </table></td></tr></table></div></div></div><div class="pbFooter secondaryPalette"><div class="bg"></div></div></div></div></div></div>
hello,
i am using this code for backgrond image or color but both aren't support in vf page.
this are appear on the sidebar and showheader section.

*{                 <!------------| page global setting |---------------->
    margin:0px;
    padding:0px;
    background-color:#0f0;   
    //background-image:url('{!$Resource.bg1img}');

what will be the solution.
Hi,

 I want to store below visualforce code inside controller based on the selection is made .

VisualForce
<apex:pageBlockSectionItem >
   <apex:outputLabel value="Expiry Term:" for="expireterm"/>
   <apex:selectList value="{!ExpireTerms}" multiselect="false" size="1" id="expterms" readonly="true">
                <apex:selectOption itemValue="1" itemLabel="1 Year"/>
                <apex:selectOption itemValue="3" itemLabel="3 Year"/>
                <apex:selectOption itemValue="5" itemLabel="5 Year"/>
    </apex:selectList>
   </apex:pageBlockSectionItem> 

<apex:pageBlockSectionItem >
   <apex:outputLabel value="Expiry Term:" for="expireterm"/>
   <apex:selectList value="{!ExpireTerms}" multiselect="false" size="1" id="expterms" readonly="true">
                <apex:selectOption itemValue="1" itemLabel="1 Year"/>
                <apex:selectOption itemValue="3" itemLabel="3 Year"/>
                <apex:selectOption itemValue="5" itemLabel="5 Year"/>
    </apex:selectList>
   </apex:pageBlockSectionItem> 


Please suggest me.

Thanks
Sudhir

Hello Community, 

Have a simple trigger to update the owner of a custom object (Sales_Order__c) back to the createdby when status is updated to 'Sales Order Completion':


trigger SalesOrderUpdateOwner on Sales_Order__c (before Update)
{
for(Sales_Order__c sc : trigger.new)
{
Sales_Order__c oldrecord = trigger.oldMap.get(sc.id);
if(sc.Status__c == 'Sales Order Completion' )
  {     
   sc.OwnerId = sc.CreatedById ;
        }
}
}


I just cannot seem to be able to save a test class (i'm also not a developer, so that makes it more challenging to know what i'm doing).  Was trying to create a class where I Insert a new Sales_Order__c record, with the Status__c = 'Sales Order Submitted'.  Then I tried to add an update on the Status__c = 'Sales Order Completion' (which should trigger the code), but nothing takes (various error messages based on how i'm saving it).  Not sure if it's because the status is updated via Javascript button and i have to account for that somehow on the testclass (I get to the testclass where i can create the record, but cannot seem to be able to update the record).  Any assistance is appreciated...
Hi there,

I already have all the code working, but at the end I don't need to insert all the content of the String variable.

Suppose you have a String variable called: temp --- and this variable contains the following text:

/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*
abc abc abc
defghi
jklmnopq 1234 56789

"Start"
More text More text More text More text More text More text More text More text More text More text More text
"End"

1234567890123456 Text Text Text Text Text Text Text Text
More Text Text Text Text Text Text
/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*

I only need to "extract" or "insert" the text that is between "Start" and "End" instead of inserting everything.

How do I do this? What method(s) and/or Functions could I use?

Thanks in advance.

--Nelson.
Since Saturday, the Apex class that assembles a URL to be assigned to a button on a VF page is failing to return a value if the string includes a tokenised value. ( We are using the CipherCloud tokenising gateway )

For example, the following piece of code returns nothing at all if the result of aContact.Name would be a tokenised value.

selectedinteractionurl= 'a02/e?CF00N90000007GAuz='+latestcall[0].Name+'&CF00N90000007GAuz_lkid='+latestcall[0].Id+'&CF00N90000005GWKP='+aContact.Name+'&CF00N90000005GWKP_lkid='+aContact.Id+'&retURL=/apex/CallerInteractions?id='+aContact.Id+'&renderToolbar=true';

If aContact.Name returns a non-tokenised value, then it works fine.

This was all working fine until last Saturday.
Visualforce ErrorHelp for this Page
System.QueryException: unexpected token: =
Error is in expression '{!getdata}' in component <apex:commandButton> in page dynamicsoql1: Class.dynamicsoql.getdata: line 32, column 1
Class.dynamicsoql.getdata: line 32, column 1

 
public class dynamicsoql 
{ 
    public list<account> accs{set;get;}  
    public string aname{set;get;}
    public string aindustry{set;get;}
    public string query{set;get;}
    
    public void getdata()
    {
     query='select id,name,industry from account';
        
        if((aname!='' && aname!=null) && (aindustry!='' && aindustry!=null)) 
        {
          query=query+'where Name=\''+aname+ '\' and Industry= \'' +aindustry+ '\'';
            
        }
        else
        {
            if (aname!='' && aname!=null) {
                
           query=query+'where Name=\'' +aname+ '\'';
           
            }
            
            
             if(aindustry!='' && aindustry!=null) {
           query=query+'where Industry=\''+aindustry+'\'';  
             
           }
      }
           
       accs=Database.query(query);
    }
    
}
 
<apex:page controller="dynamicsoql">
<apex:form >
    <apex:pageBlock title="record">
        <apex:pageBlockSection >
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="name"/>
            <apex:inputText value="{!aname}"/>
            </apex:pageBlockSectionItem>
             <apex:pageBlockSectionItem >
            <apex:outputLabel value="industry"/>
            <apex:inputText value="{!aindustry}"/>
            </apex:pageBlockSectionItem>
            <apex:commandButton value="submit" action="{!getdata}" reRender="one" />
        </apex:pageBlockSection>
    </apex:pageBlock>
          <apex:pageBlock id="one">
              {!query}

    <apex:pageBlockTable value="{!accs}" var="a">
        <apex:column value="{!a.name}"/>
        <apex:column value="{!a.industry}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
       </apex:form>
</apex:page>

 
Hi I am trying to send a cURL update to a salesforce object. I have had no problem with other fields like checkbox and picklist but I cannot figure out a hierarchy sobject. The field I am trying to update via cURL is 

Name: Parent Account                         API: Parent                                            Type: Hierarchy

What my content looks like is below with the following error. What do I need to do to send a valid cURL command to update this field?

Content
$content = json_encode ( array (
			"Name" => $fields ['Client_Name'],
			"Parent" => 'Some Nested SObject'
	) );

The error is:
[{"message":"The value provided for foreign key reference Parent is not a nested SObject","errorCode":"INVALID_FIELD"}]

Thanks for any help :)
 
Hi,

I am having a regex expression for a perticular format. The format is working a I want, but now I want to add Starting and Trailing spaces with the expression. but didn't succeed, 

My regext expression is [a-zA-Z]{1}(\d){8}​

Any help would be appreciated.
I am working on Activities. 
and due to data size all the size when we load the tab. It gets timed-out. So we have have created a view populating records created today.

but not able to set thie view as default.
I am new to Salesforce and not very much familier with the PageReferences etc.

Need help......This very urgent. 
I'm doing the simple lightning components challenge and have hit this problem in my existing trailhead org and a brand new dev org that I've just created:

Challenge not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: QVWBQHAG
Hi folks,
    Can anyone tell me what is REST API and how to excute REST API in salesforce

Thanks in advance
Karthick
Hello, I am very new to Salesforce and after having successfully written a trigger, with a great deal of help from the forum, I am having some issues with the test class. I thought it would be enough to test an example of where the trigger would be fired and see if the trigger did the job but apparently it is not, as I only got 73% of the lines tested. So I wanted your feedback on what I did wrong, any help is appreciated.

The trigger, the issues seem to be with the maps and towards the end:
Trigger FollowUpTask on Task(after update) {

     Set<Id> completedTasks = new Set<Id>();
     Set<Id> contactIds = new Set<Id>();
     Set<Id> accountIds = new Set<Id>();
 
     for (Task task: Trigger.new) {
     
          if (task.Status != Trigger.oldMap.get (task.Id).Status && task.Status=='Completed')
               completedTasks.add(task.Id);
               contactIds.add(task.WhoId);
               accountIds.add(task.WhatId);
          }
 
     contactIds.remove(null);
     accountIds.remove(null);
 
     Map<Id, Contact> contactMap = new Map<Id, Contact>();
     Map<Id, Account> accountMap = new Map<Id, Account>();
 
     if (!contactIds.isEmpty()) {
          contactMap = new Map<Id, Contact>([
               select Contact_Frequency__c,
                    Name
               from Contact
               where Id in :contactIds
          ]);
     }
 
     if (!accountIds.isEmpty()) {
          accountMap = new Map<Id, Account>([
               select Primary_Contact__c,
                    Name,
                    Tier__c
               from Account
               where Id in :accountIds
          ]);
     }

     List<Task> newTasks = new List<Task>();
     for (Id id: completedTasks) {
          Task task = Trigger.newMap.get(id);
          Contact contact = contactMap.get(task.WhoId);
          Account account = accountMap.get(task.WhatId);
 
          if (account == null || contact == null) {
               continue;
          }
 
          Task newTask = new Task(
               Subject = 'Follow Up ' + account.Name + '/' + contact.Name,
               OwnerId = account.OwnerId,
               WhoId = account.Primary_Contact__c,
               WhatId = account.Id,
               Priority = (account.Tier__c == 'Tier 1') ? 'High' : 'Normal'
               );    
 
          Date duedate = system.today().addDays((Integer)(contact.Contact_Frequency__c));
          newTask.ActivityDate = dueDate;
 
          newTasks.add(newTask);
     }
 
     if (!newTasks.isEmpty()) {
          insert newTasks;
     }
}

And this is the test class, I am sure there are a ton of errors:
@istest
public class FollowUpTaskTest {

  static testmethod void testFollowUpTask ()
  {
      Contact Ctc = new Contact (LastName = 'TestContact',
                                 Contact_Frequency__C = 30);
      
      Account Acc = new Account (Name = 'TestAccount',
                                 Rank__C = 3,
                                 Primary_Contact__C = Ctc.Id,
                                 OwnerId = '00520000003j1B2');
       
      Date Today = System.today();
          
      Task Tsk = new Task (	Subject = 'TestTask', 
                   			OwnerId = '00520000003j1B2',
                   			WhoId = Ctc.Id,
                   			WhatId = Acc.Id,
                   			Priority = 'Normal',
                           	Status = 'Not Started',
                           	ActivityDate = Today.addDays(5)
                           	);
       insert Acc;
       insert Ctc;
       insert Tsk;
          
  		Test.startTest();
        Tsk.Status = 'Completed';
        Update Tsk;
      	Test.stopTest();
        
      Tsk = [select Id, Subject, OwnerId, WhatId, WhoId, Priority, Status, ActivityDate
                 	from Task
                 	where WhatId = :Acc.Id
                 	and WhoId = :Ctc.Id
          			and ActivityDate = :Today.addDays((integer)(Ctc.Contact_Frequency__C)) ];
      
      System.assert(Tsk.ActivityDate == Today.addDays((integer)(Ctc.Contact_Frequency__C)));
      System.assert(Tsk.OwnerId == Acc.OwnerId);
      System.assert(Tsk.Subject == 'Follow Up ' + Acc.Name + '/' + Ctc.Name);
      System.assert(Tsk.WhoId == Acc.Primary_Contact__c);
      System.assert(Tsk.WhatId == Acc.Id);
      System.assert(Tsk.Priority =='High');          
          }
    }


hi friends,
 this trigget is not working.
my aim is to print an error message  if the selected url is shine.com

 could you help me..?

trigger ppp on Job_Posting__c (before insert,before update) {

//Employment_Website__c web=new Employment_Website__c();
for (Job_Posting__c jobInLoop : Trigger.new) {
        if(String.valueOf(jobInLoop.Employment_Website__c)=='http://Shine.com'){
       
        jobInLoop.addError('WE cannot post your Job to shine.com');
        }
    }
//Web_Address__c   Price_Per_Post__c

}
I have a custom field on Account called CountChild__c, so now I want to write a trigger on Account to count it's related contacts and update that fild  CountChild__c, so if a Account will have 3 Contacts then that CountChild__c field on Account should be update with the value 3. How can I achove it through trigger? Please guide me. Thank you.
I tried to create a lookup and got the error 'Id value 005L0000001DUZ7 is not valid for the Contact standard controller'

<apex:page standardcontroller="Contact">
<apex:form >

<apex:inputField value="{!Contact.Account}"/>

</apex:form>
</apex:page>

any help please.
I have a page block section contain picklist and input filed i filled all the field and picklist also .after that i clicked "add more" button it re render same page block without values BUT ABOVE SECTION SHOULD BE FILLED AS IT IS PICKLIST ALSO plz solve it 
I have created a dynamic soql in controller but while using it with IN operator its not showing the query properly....
<apex:page controller="dynamicsoql">
    <apex:form>
        <apex:pageBlock >
            <apex:pageBlockSection id="pbs">
                <apex:outputText>{!idinlist}</apex:outputText>
                <apex:inputTextarea value="{!query}" />
            </apex:pageBlockSection>
            <apex:commandButton action="{!showid}" value="showid" reRender="pbs"/>
            <apex:commandButton action="{!showquery}" value="showquery" reRender="pbs"/>
        </apex:pageBlock>
    </apex:form>
</apex:page>
.........................................................................
public class dynamicsoql {
    public list<j__c> recordid { get; set; }
    public string singleid{get;set;}
    public list<string> idinlist{get;set;}
    public string query {get;set;}
    public dynamicsoql()
    {
     recordid=[select id from j__c];
     idinlist=new list<string>();
    }
    public void showid()
    {
        for(j__c j: recordid)
        {
            singleid='\''+string.valueOf(j.id)+'\'';
            idinlist.add(singleid);
        }
    }
    public void showquery()
    {
        query ='select name from j__c where id in '+  idinlist ;
    }
}

In my controller their is a dynamic soql query----

(((((((((((query ='select name from j__c where id in '+  idinlist ;))))))))))))))))

in this query ""idinlist"" is a list of id's. If in the list their are only 10 id then its fine and the query is printed in the vf page in this form
select name from j__c where id in ('a019000000FRJDkAAP', 'a019000000FRJDzAAP', 'a019000000FRJEdAAP', 'a019000000FRJEeAAP', 'a019000000FRJFCAA5', 'a019000000FRJFDAA5', 'a019000000FRJFEAA5', 'a019000000FRJFFAA5', 'a019000000FRJFlAAP', 'a019000000FRJGSAA5')

but if  ""idinlist"" has more then 10 id's then its query is printed in this form

select name from j__c where id in ('a019000000FRJDkAAP', 'a019000000FRJDzAAP', 'a019000000FRJEdAAP', 'a019000000FRJEeAAP', 'a019000000FRJFCAA5', 'a019000000FRJFDAA5', 'a019000000FRJFEAA5', 'a019000000FRJFFAA5', 'a019000000FRJFlAAP', 'a019000000FRJGSAA5',...)

means after 10th id it's just showing '''...''' and no id. i had printed the query in vf page system debug every where it's the same.
and because of that my query is not working. Please help.


Declare and populate array of string containing month names viz. January, February
Hi all, 

Whenever i try to use the test class method 'getStandardPricebookId()'  ,im getting the error 'Method does not exist or incorrect signature'.
Any help is highly appreciated.
Thanks in advance.
Im on API version 30.
I have VF page.In that page having one button called "Insert".
My requiement is
"when that "insert" button clicked it should redirect to Custom Object's edit page"
How can i acheive it.
Hi All,
My scenario when opportunity stage is closed won  it should create certification record under that opportunity .But it should create only one time.I wrote a trigger as follows:
trigger CertificationDetailsautocreate on Opportunity(after insert,before update)

{

         List<Certification_Detail__c> listCd = new List<Certification_Detail__c>();
       
        //Id rtId = [select Id,name from RecordType where name='Certification - Public(Company Sponsered)' and SObjectType='Opportunity_Detail__c' limit 1].Id;
       
        for(Opportunity O : trigger.new)
        {

        if(Trigger.isInsert)

            {

                if(O.StageName =='Closed Won')

                {

                  listCd.add(new Certification_Detail__c(

                  //RecordTypeId = rtId ,

                  Opportunity__c= O.Id,
                  Account__c=O.AccountId,                              
                  Program_Name__c=O.Certification_Program__c

                  ));

               }
              
                 
              

            }

    

        if(listCd.size() > 0)

        {

            insert listCd;

        }
       
        if(Trigger.isUpdate)
        {
        if(O.StageName =='Closed Won')

                {

                  listCd.add(new Certification_Detail__c(

                  //RecordTypeId = rtId ,

                  Opportunity__c= O.Id,
                  Account__c=O.AccountId,                              
                  Program_Name__c=O.Certification_Program__c

                  ));

               }
               

       

            insert listCd;

       
        /*if(Trigger.isAfter&&Trigger.isupdate)

            {
            for(Opportunity O:Trigger.new)
            {
            if(O.StageName =='Closed Won')
            {
            listCd.add(new Certification_Detail__c(

                  //RecordTypeId = rtId ,

                  Opportunity__c= O.Id,
                  Account__c=O.AccountId,                              
                  Program_Name__c=O.Certification_Program__c

                  ));
            }
if(listCd.size() > 0)

        {

            Update listCd;

        }
       
    }
    }*/
    }
    }
    }
But the problem is every time i am changing the stage to closed won it is creating so many certification records under 1 opportunity .I want under 1 opportunity 1 certification record to be created when stage is changed to closed won.
Please any one help me to solve this issue in urgent Basis.Thanks in advance
Hi Team,

i need to add custom fields While creating new account into the Salesforce can i do it in trial version?Plese see the attechmenr

User-added image
Would like to write an afterupdate trigger against the Salesforce "Partner" object.  It is not availble to pick in the Eclipse IDE.  Is this some type of setting in Eclipse that I missed? 
I'm doing the simple lightning components challenge and have hit this problem in my existing trailhead org and a brand new dev org that I've just created:

Challenge not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: QVWBQHAG