• Prem Chauhan
  • NEWBIE
  • 32 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 18
    Questions
  • 27
    Replies
syntax to accept only 10 digit number in inputText Field and should't contain any character please help me with this (Without Javascript)              
My SOQL: [SELECT ID,Name, Status FROM Lead WHERE CreatedDateNotEqualToLastModified__c = TRUE AND LastModifiedDate >= LAST_N_DAYS:2];

Can anyone help with this URGENT?????
Hi Team,

Requirement : I have created custom vf page for showing detailed record. Form here i have created custom clone button. I want to clone the record from detail page and i need to edit the fields as our own details (not existing record details) and create a new record.
How can we write additional vf page and controller class for cloning functionality.
Note : After clicking on clone button that page redirected to another page and show the record details, if i click on cancel button no need to create new record, until clicking on save button.

Please let me know any one , how can we achieve this functionality........


Thanks in Advance!....
Lakshmi.
 
I'm creating approval process in opportunity when engagement_model__c not equal to none which is a picklist field, an email should be sent to users.
im getting the email, but I'm not getting the link. I don't the issue. Help me to solve it.

Need Urgent Help,

Actually, the scenario is I have a currency field in Account as well as in Opportunity.
and Account is mapped with Opportunity.

whenever my account selects the Currency Record type as  USD then the Account's currency fields (ABC__c) = $1000.00 shows a value correct.

but while creating the opportunity I'll select this account as a lookup. and some fields are already mapped.
but such scenario my opportunity's  Currency Record type is UAE when I save my opportunity than the value of account's Field (ABC__c) doesn't get converted.
Still, it shows a value of $1000 didn't get converted to UAE 


Please HELP ME FROM THIS SITUATION.

Many Thanks in Advance.
 

trigger Job_Posting_Trigger_To_Update_Position_Fields on Job_Posting__c (after insert, after delete, after update) {   
 
//These 4 are my customn fields on my Custom object Position__c 
 //here Job_Posting__c  is the junction Object between " Position__c And Employment_Website__c "
 
    Decimal totPrice = 0;
    Decimal TotalBudget = 0;
    Decimal Totalpost = 0;
    Decimal max = 0;
    Decimal min = 0;
    
    
    List<Position__c> lstOfposupdate = new List<Position__c>();
    //Position__c objPosition = new Position__c();
    // Set<string> SetofOfEmployeeWebSiteIds = new Set<String>();
    
    Set<string> SetOfJobPosting = new Set<String>();
    // List<string> LstOfpostIds = new List<String>();
    
    List<Job_Posting__c> lstForJobPosting = new List<Job_Posting__c>();
    List<Job_Posting__c> lstForJobPostingMax = new List<Job_Posting__c>();
    List<Job_Posting__c> lstForJobPostingMin = new List<Job_Posting__c>();
    
    // List<Employment_Website__c> lstForEmpWeb = new List<Employment_Website__c>();
    string posIdToSet = '';
    
     List<Job_Posting__c > allbulkdata = trigger.isdelete ? trigger.old : trigger.new ;
       for(Job_Posting__c JobPostingObj : allbulkdata) {
            SetOfJobPosting.add(JobPostingObj.Position__c);
            posIdToSet = JobPostingObj.Position__c;
        }
    
   /* if(Trigger.isInsert){ 
        for(Job_Posting__c JobPostingObj : Trigger.new) {
            SetOfJobPosting.add(JobPostingObj.Position__c);
            posIdToSet = JobPostingObj.Position__c;
        }
    }
    
    if(Trigger.isDelete){ 
        for(Job_Posting__c JobPostingObj :Trigger.old) {
            SetOfJobPosting.add(JobPostingObj.Position__c);
            posIdToSet = JobPostingObj.Position__c;
        }
    }
    
    if(Trigger.isUpdate){ 
        for(Job_Posting__c JobPostingObj : Trigger.old) {
            Job_Posting__c  objJobPostingOldVal = Trigger.oldMap.get(JobPostingObj.Id);
            SetOfJobPosting.add(JobPostingObj.Employment_Website__c);
            posIdToSet = JobPostingObj.Employment_Website__c;
        }
    }*/
    
    If(SetOfJobPosting.size()>0){
        
        lstForJobPosting = [select Id,Name,Position__c,Employment_Website__r.Price_Per_Post__c,
                            Employment_Website__r.Maximum_Budget__c
                            from Job_Posting__c 
                            where Position__c IN:SetOfJobPosting] ;       
        
        lstForJobPostingMax = [select Id,Name,Position__c,Employment_Website__r.Price_Per_Post__c,
                               Employment_Website__r.Maximum_Budget__c
                               from Job_Posting__c 
                               where Position__c IN:SetOfJobPosting
                               Order By Employment_Website__r.Price_Per_Post__c desc] ; 
        
        if(lstForJobPostingMax.size()>0){            
            max = lstForJobPostingMax[0].Employment_Website__r.Price_Per_Post__c;   
        }
        
        
        lstForJobPostingMin = [select Id,Name,Position__c,Employment_Website__r.Price_Per_Post__c,
                               Employment_Website__r.Maximum_Budget__c
                               from Job_Posting__c 
                               where Position__c IN:SetOfJobPosting
                               Order By Employment_Website__r.Price_Per_Post__c Asc]; 
        
        if(lstForJobPostingMin.size()>0){            
            min = lstForJobPostingMin[0].Employment_Website__r.Price_Per_Post__c; 
        }
        
        for(String posId : SetOfJobPosting){   
            Totalpost = lstForJobPosting.size();
            for(Job_Posting__c jpObj : lstForJobPosting){ 
                
                if(posId == jpObj.Position__c){    
                    
                    totPrice = totPrice + jpObj.Employment_Website__r.Price_Per_Post__c ;
                    TotalBudget = jpObj.Employment_Website__r.Maximum_Budget__c + TotalBudget;                    
                }
            }
        }
        
        Position__c posUpdate = new Position__c();
        posUpdate.Id = posIdToSet;
        posUpdate.Total_Budget__c = TotalBudget;
        posUpdate.Total_Price_of_post__c = totPrice;
        posUpdate.Min_Price_of_Post__c = min ;
        posUpdate.Max_Price_of_Post__c = max;
        posUpdate.Total_Post__c = Totalpost;
        
        lstOfposupdate.add(posUpdate);
        
        if(lstOfposupdate.size()>0){
            update lstOfposupdate;
            System.debug('<==Updated succesfully==>');
        }
        
        
    }
}




User-added image
User-added image
When i click on new job Posting button it will ask me to select employment website when i select any one among multiple website then Price Per Post, Maximum Budget  is added Automatically, when i do update for inserted job posting records the fields on the position won't get update for that perticular position, Only related list is getting update for that perticular position.
In this case Update is not working..
[ There are totally 3 objects are there 1:jobPosting__c  2:  Employment_website__c 3 :Position__c ]


Thanks in Advance 

Prem Chauhan
1. salesprocess flow of execution
2.service clooud process flow of execution
Hi,

I have written the below classes as part of the trailhead challenge for Apex REST callouts.

The class -

public class AnimalLocator {
  
  public static String getAnimalNameById(Integer id) {
    
    Http http = new Http();
    HttpRequest request = new HttpRequest();
    request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals/'+id);
    request.setMethod('GET');
    
    HttpResponse response = http.send(request);
    List<Object> animals; 
    String returnValue; 
    
    // parse the JSON response
    if (response.getStatusCode() == 200) {
      Map<String, Object> result = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
      animals = (List<Object>) result.get('animals');
      System.debug(animals);
    }
    
    if (animals.size() > 0 && animals != NULL && id < animals.size()) {
      returnValue = (String) animals.get(id);
    }
    
    return returnValue;
  } 
    
}

Mock Response Class - 

@isTest
global class AnimalLocatorMock implements HttpCalloutMock {
     // Implement this interface method
    global HTTPResponse respond(HTTPRequest request) {
        // Create a fake response
        HttpResponse response = new HttpResponse();
        response.setHeader('Content-Type', 'application/json');
        response.setBody('{"animals": ["majestic badger", "fluffy bunny", "scary bear", "chicken", "mighty moose"]}');
        response.setStatusCode(200);
        return response; 
    }
}

Test Class - 

@isTest
private class AnimalLocatorTest{
    @isTest static void AnimalLocatorMock1() {
        Test.setMock(HttpCalloutMock.class, new AnimalLocatorMock());
        string result = AnimalLocator.getAnimalNameById(3);
        String expectedResult = 'chicken';
        System.assertEquals(result,expectedResult );
    }
}

I have got 100% code coverage for the main class. But when I check the challenge I get 

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.NullPointerException: Attempt to de-reference a null object

Please tell me if any changes to the code is required. It's really frustrating as I am stuck from past 3-4 days with this unit.

Thanks & Regards,

Abhiram Sheshadri

 

Hi,

 

Integer i;

 

Public Integer i;

 

What is the difference between above two declaration.

i ran the below program in Apex  but i am getting error so please could you help me.

 

public  class SimpleArrayClass
{public static  integer findSum(Integer[]a)
{
Integer s=0;
for(integer x:a)
{s=s+x;
  }
 
 
return s;
}

  }

--------------------

 

@isTest
public class SimpleArrayTestClass
{
 @isTest Static Void sumTest()
{
Integer [] a=new Integer[4]{10,20,30,40};
integer act=0,exp=100;
act=SimpleArrayClass.findsum(a);
system.debug('Actual Value...' +act);
}
}

Hi all

 

what is difference between sales cloud and service cloud?

 I am Unable to understand 

 

Regards

 

Linganna

I have an apex:inputCheckBox, I'm trying to use the attribute value="{!ChkBoxVal}". In my custom controller, I declared Boolean ChkBoxVal - I tried to make it Public. I've looked around for some sample code, but failed. How do I declare it? How do I get it from page to page, like in the Wizard example?

Thanks,