• vajrala
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 18
    Questions
  • 11
    Replies

I am creating two users one is administrator another one is sanded user.

I entered data into object from both users.

But one entered data is not visible to another.

But i need see and access two users entered data into both users.

Is it possible please give me explanation with an example

 

I am interesting  to learn , how work with sandbox .

I know it is available only Enterprise and Unlimited Editions.

But i don't know how to create enterprise editions and how to create sandbox.

Is it possible to create Enterprise editions free .

please give me solution

i not understanding usage of junction object .

Please explain usage and how to create junction object with a example

I feced problems after writing the apex class .How to run the apex class .

please give me explanation with an example

I am to Force.com ide Please give me solutions how to configure ide and run apex class

When i creating the new Project in Force.com ide

 it ask project name,user name,password and security token. i selece first option in next step

it shows following error

 

please give me solution

when double click on Force.com IDE Installer it shows following error

.

I wrote the trigger for dynamic approval process ,i.e sunmit,Approve and reject successfully.

But i faced problems while writing the test class for this trigger to cover the code.please give me solution for the following trigger

to cover the code.

trigger AutomateApprove on Patient__c(After insert, After update)
{
    for (Integer i = 0; i < Trigger.new.size(); i++){
        try{
            //Insure that previous value not equal to current, else if there is any field update on approval process action
            //there will be recurrence of the trigger.
            if(Trigger.new[i].Next_Step__c == 'Submit' && ((Trigger.isInsert || Trigger.old[i].Next_Step__c != 'Submit'))){
                submitForApproval(Trigger.new[i]);
            }
            else if(Trigger.new[i].Next_Step__c == 'Approve' && ((Trigger.isInsert || Trigger.old[i].Next_Step__c != 'Approve'))){
                approveRecord(Trigger.new[i]);
            }
            else if(Trigger.new[i].Next_Step__c == 'Reject' && ((Trigger.isInsert || Trigger.old[i].Next_Step__c != 'Reject'))){
                rejectRecord(Trigger.new[i]);
            }

        }catch(Exception e){
            Trigger.new[i].addError(e.getMessage());
        }
    }

    // This method will submit the opportunity automatically
    public void submitForApproval(Patient__c opp){
        // Create an approval request for the Opportunity
        Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
        req1.setComments('Submitting request for approval automatically using Trigger');
        req1.setObjectId(opp.id);
        req1.setNextApproverIds(new Id[] {opp.Next_Approver1__c});

        // Submit the approval request for the Opportunity
        Approval.ProcessResult result = Approval.process(req1);
    }

    //Get ProcessInstanceWorkItemId using SOQL
    public Id getWorkItemId(Id targetObjectId){
        Id retVal = null;
        for(ProcessInstanceWorkitem workItem  : [Select p.Id from ProcessInstanceWorkitem p where p.ProcessInstance.TargetObjectId =: targetObjectId]){
            retVal  =  workItem.Id;
        }

        return retVal;
    }

    // This method will Approve the opportunity
    public void approveRecord(Patient__c opp){
        Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();
        req.setComments('Approving request using Trigger');
        req.setAction('Approve');
        req.setNextApproverIds(new Id[] {opp.Next_Approver1__c});
        Id workItemId = getWorkItemId(opp.id);
        //opp.addError(workItemId);
        if(workItemId == null){
            opp.addError('Error Occured in Trigger');
            //opp.addError(workItemId);
        }
        else{
            req.setWorkitemId(workItemId);
            // Submit the request for approval
            Approval.ProcessResult result =  Approval.process(req);
        }
    }

    // This method will Reject the opportunity
    public void rejectRecord(Patient__c opp){
        Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();
        req.setComments('Rejected request using Trigger');
        req.setAction('Reject');
        //req.setNextApproverIds(new Id[] {UserInfo.getUserId()});
        Id workItemId = getWorkItemId(opp.id);
        //opp.addError(workItemId);

        if(workItemId == null){
            opp.addError('Error Occured in Trigger');
            //opp.addError(workItemId);
        }
        else{
            req.setWorkitemId(workItemId);
            // Submit the request for approval
            Approval.ProcessResult result =  Approval.process(req);
        }
    }

}

please give me solution to cover the following trigger

 

trigger AutomateApprove on Patient__c(After insert, After update)
{
    for (Integer i = 0; i < Trigger.new.size(); i++){
        try{
            //Insure that previous value not equal to current, else if there is any field update on approval process action
            //there will be recurrence of the trigger.
            if(Trigger.new[i].Next_Step__c == 'Submit' && ((Trigger.isInsert || Trigger.old[i].Next_Step__c != 'Submit'))){
                submitForApproval(Trigger.new[i]);
            }
            else if(Trigger.new[i].Next_Step__c == 'Approve' && ((Trigger.isInsert || Trigger.old[i].Next_Step__c != 'Approve'))){
                approveRecord(Trigger.new[i]);
            }
            else if(Trigger.new[i].Next_Step__c == 'Reject' && ((Trigger.isInsert || Trigger.old[i].Next_Step__c != 'Reject'))){
                rejectRecord(Trigger.new[i]);
            }

        }catch(Exception e){
            Trigger.new[i].addError(e.getMessage());
        }
    }

    // This method will submit the opportunity automatically
    public void submitForApproval(Patient__c opp){
        // Create an approval request for the Opportunity
        Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
        req1.setComments('Submitting request for approval automatically using Trigger');
        req1.setObjectId(opp.id);
        req1.setNextApproverIds(new Id[] {opp.Next_Approver1__c});

        // Submit the approval request for the Opportunity
        Approval.ProcessResult result = Approval.process(req1);
    }

    //Get ProcessInstanceWorkItemId using SOQL
    public Id getWorkItemId(Id targetObjectId){
        Id retVal = null;
        for(ProcessInstanceWorkitem workItem  : [Select p.Id from ProcessInstanceWorkitem p where p.ProcessInstance.TargetObjectId =: targetObjectId]){
            retVal  =  workItem.Id;
        }

        return retVal;
    }

    // This method will Approve the opportunity
    public void approveRecord(Patient__c opp){
        Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();
        req.setComments('Approving request using Trigger');
        req.setAction('Approve');
        req.setNextApproverIds(new Id[] {opp.Next_Approver1__c});
        Id workItemId = getWorkItemId(opp.id);
        //opp.addError(workItemId);
        if(workItemId == null){
            opp.addError('Error Occured in Trigger');
            //opp.addError(workItemId);
        }
        else{
            req.setWorkitemId(workItemId);
            // Submit the request for approval
            Approval.ProcessResult result =  Approval.process(req);
        }
    }

    // This method will Reject the opportunity
    public void rejectRecord(Patient__c opp){
        Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();
        req.setComments('Rejected request using Trigger');
        req.setAction('Reject');
        //req.setNextApproverIds(new Id[] {UserInfo.getUserId()});
        Id workItemId = getWorkItemId(opp.id);
        //opp.addError(workItemId);

        if(workItemId == null){
            opp.addError('Error Occured in Trigger');
            //opp.addError(workItemId);
        }
        else{
            req.setWorkitemId(workItemId);
            // Submit the request for approval
            Approval.ProcessResult result =  Approval.process(req);
        }
    }

}

how to write the test methode to follwing trigger

trigger AutomateApprove on Patient__c(After insert, After update)
{
    for (Integer i = 0; i < Trigger.new.size(); i++){
        try{
            //Insure that previous value not equal to current, else if there is any field update on approval process action
            //there will be recurrence of the trigger.
            if(Trigger.new[i].Next_Step__c == 'Submit' && ((Trigger.isInsert || Trigger.old[i].Next_Step__c != 'Submit'))){
                submitForApproval(Trigger.new[i]);
            }
            else if(Trigger.new[i].Next_Step__c == 'Approve' && ((Trigger.isInsert || Trigger.old[i].Next_Step__c != 'Approve'))){
                approveRecord(Trigger.new[i]);
            }
            else if(Trigger.new[i].Next_Step__c == 'Reject' && ((Trigger.isInsert || Trigger.old[i].Next_Step__c != 'Reject'))){
                rejectRecord(Trigger.new[i]);
            }

        }catch(Exception e){
            Trigger.new[i].addError(e.getMessage());
        }
    }

    // This method will submit the opportunity automatically
    public void submitForApproval(Patient__c opp){
        // Create an approval request for the Opportunity
        Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
        req1.setComments('Submitting request for approval automatically using Trigger');
        req1.setObjectId(opp.id);
        req1.setNextApproverIds(new Id[] {opp.Next_Approver__c});

        // Submit the approval request for the Opportunity
        Approval.ProcessResult result = Approval.process(req1);
    }

    //Get ProcessInstanceWorkItemId using SOQL
    public Id getWorkItemId(Id targetObjectId){
        Id retVal = null;
        for(ProcessInstanceWorkitem workItem  : [Select p.Id from ProcessInstanceWorkitem p
        where p.ProcessInstance.TargetObjectId =: targetObjectId]){
            retVal  =  workItem.Id;
        }

        return retVal;
    }

    // This method will Approve the opportunity
    public void approveRecord(Patient__c opp){
        Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();
        req.setComments('Approving request using Trigger');
        req.setAction('Approve');
        req.setNextApproverIds(new Id[] {opp.Next_Approver__c});
        Id workItemId = getWorkItemId(opp.id);
        //opp.addError(workItemId);
        if(workItemId == null){
            opp.addError('Error Occured in Trigger');
            //opp.addError(workItemId);
        }
        else{
            req.setWorkitemId(workItemId);
            // Submit the request for approval
            Approval.ProcessResult result =  Approval.process(req);
        }
    }

    // This method will Reject the opportunity
    public void rejectRecord(Patient__c opp){
        Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();
        req.setComments('Rejected request using Trigger');
        req.setAction('Reject');
        //req.setNextApproverIds(new Id[] {UserInfo.getUserId()});
        Id workItemId = getWorkItemId(opp.id);
        //opp.addError(workItemId);

        if(workItemId == null){
            opp.addError('Error Occured in Trigger');
            //opp.addError(workItemId);
        }
        else{
            req.setWorkitemId(workItemId);
            // Submit the request for approval
            Approval.ProcessResult result =  Approval.process(req);
        }
    }

}

I got error:-  Error: Invalid Data. Review all error messages below to correct your data.
Attempt to de-reference a null object

while writing the following code.

trigger AutomateApprove on Opportunity(After insert, After update)
{

    for (Integer i = 0; i < Trigger.new.size(); i++)
    {
     try
     {
        //Insure that previous value not equal to current, else if there is any field update on approval process action
        //there will be recurrence of the trigger.

        if(Trigger.new[i].Next_Step__c == 'Submit' && Trigger.old[i].Next_Step__c != 'Submit')
        {
           submitForApproval(Trigger.new[i]);
        }
        else if(Trigger.new[i].Next_Step__c == 'Approve' && Trigger.old[i].Next_Step__c != 'Approve')
        {
             approveRecord(Trigger.new[i]);
        }
        else if(Trigger.new[i].Next_Step__c == 'Reject' && Trigger.old[i].Next_Step__c != 'Reject')
        {
             rejectRecord(Trigger.new[i]);
        }
     }catch(Exception e)
     {
         Trigger.new[i].addError(e.getMessage());
     }
    }
please give me solution

I am not undestanding where we use system.assert() and system.assertEquals() and how it is working

please give me explanation with an example

I am not understanding what is the use of newMap,oldMap and how it used.

please give me explanation with example

i need clarity about insert before and insert after.

what happens when we use before insert and after insert

please give me clarification with an example

when i reply for the email alert of approval process through gmail the reply message again comes to my gmail not go to salesforce.please help me how to reply the approval process either approved or rejected through gmail

I applied client side validations by using javascript Like

<script type="text/javascript">
        var rname=/^([A-Za-z]\s?)+(\w\s?)*$/;
        var rphone=/\d{10}/;
        var remail=/^([a-z]+\w*)+\@+([a-z]+\w*)+\.+([a-z]*)$/;
        var rcity=/^[A-Za-z]*$/;
        var rstate=/^[A-Za-z]*$/;
        var rcountry=/^[A-Za-z]*$/;
        ErrorText='';
        function myfunction(){
            var sfname=document.getElementById('{!$Component.myform.entry.Patient_entry_section:pafname}').value;
            var slname=document.getElementById('{!$Component.myform.entry.Patient_entry_section:palname}').value;
            var sphone=document.getElementById('{!$Component.myform.entry.Patient_entry_section:paphone}').value;
            var semail=document.getElementById('{!$Component.myform.entry.Patient_entry_section:paemail}').value;
            var saddress1=document.getElementById('{!$Component.myform.entry.Demographic_entry_section:address1}').value;
            var saddresstype=document.getElementById('{!$Component.myform.entry.Demographic_entry_section:addresstype}').value;
            var scity=document.getElementById('{!$Component.myform.entry.Demographic_entry_section:city}').value;
            var sstate=document.getElementById('{!$Component.myform.entry.Demographic_entry_section:state}').value;
            var scountry=document.getElementById('{!$Component.myform.entry.Demographic_entry_section:country}').value;
            if(sfname!=''){
                if(!rname.test(sfname))
                ErrorText+="\n        First name must be start with Alphabates and allows only single space";
            }else{
                ErrorText+="\n        First Name is Required Field it must be Non-Empty";
            }
            if(slname!=''){
                if(!rname.test(slname))
                ErrorText+="\n        Last name must be start with Alphabates and allows only single space";
            }else{
                ErrorText+="\n        Last Name is Required Field it must be Non-Empty";
            }  
            if(sphone!=''&&(!rphone.test(sphone)))
                ErrorText+="\n        Phone number must contain 10 numbers";
            if(semail!=''&&(!remail.test(semail)))
                ErrorText+="\n        Invalid Email formate";
            if(saddress1=='')
                ErrorText+="\n        Address1 is Required Field it must be Non-Empty";
            if(saddresstype=='')
                ErrorText+="\n        Address Type is Required Field it must be Non-Empty";
            if(scity!=''&&(!rcity.test(scity)))
                ErrorText+="\n        City allows only Alphabets";
            if(sstate!=''&&(!rstate.test(sstate)))
                ErrorText+="\n        State allows only Alphabets";
            if(scountry!=''&&(!rcountry.test(scountry)))
                ErrorText+="\n        Country allows only Alphabets";
            if (ErrorText!= "") {
                alert("Error :" + ErrorText);
                return false;
            }
            else{
                alert("success");
                return true;
            }
                
       }
    </script>

It show alert messages.I need disply the javascript validation messages below the input field.please giveme explanation with an example.

i not understanding usage of junction object .

Please explain usage and how to create junction object with a example

I am interesting  to learn , how work with sandbox .

I know it is available only Enterprise and Unlimited Editions.

But i don't know how to create enterprise editions and how to create sandbox.

Is it possible to create Enterprise editions free .

please give me solution

I feced problems after writing the apex class .How to run the apex class .

please give me explanation with an example

I am to Force.com ide Please give me solutions how to configure ide and run apex class

I got error:-  Error: Invalid Data. Review all error messages below to correct your data.
Attempt to de-reference a null object

while writing the following code.

trigger AutomateApprove on Opportunity(After insert, After update)
{

    for (Integer i = 0; i < Trigger.new.size(); i++)
    {
     try
     {
        //Insure that previous value not equal to current, else if there is any field update on approval process action
        //there will be recurrence of the trigger.

        if(Trigger.new[i].Next_Step__c == 'Submit' && Trigger.old[i].Next_Step__c != 'Submit')
        {
           submitForApproval(Trigger.new[i]);
        }
        else if(Trigger.new[i].Next_Step__c == 'Approve' && Trigger.old[i].Next_Step__c != 'Approve')
        {
             approveRecord(Trigger.new[i]);
        }
        else if(Trigger.new[i].Next_Step__c == 'Reject' && Trigger.old[i].Next_Step__c != 'Reject')
        {
             rejectRecord(Trigger.new[i]);
        }
     }catch(Exception e)
     {
         Trigger.new[i].addError(e.getMessage());
     }
    }
please give me solution

I am not undestanding where we use system.assert() and system.assertEquals() and how it is working

please give me explanation with an example

I am not understanding what is the use of newMap,oldMap and how it used.

please give me explanation with example

i need clarity about insert before and insert after.

what happens when we use before insert and after insert

please give me clarification with an example

I applied client side validations by using javascript Like

<script type="text/javascript">
        var rname=/^([A-Za-z]\s?)+(\w\s?)*$/;
        var rphone=/\d{10}/;
        var remail=/^([a-z]+\w*)+\@+([a-z]+\w*)+\.+([a-z]*)$/;
        var rcity=/^[A-Za-z]*$/;
        var rstate=/^[A-Za-z]*$/;
        var rcountry=/^[A-Za-z]*$/;
        ErrorText='';
        function myfunction(){
            var sfname=document.getElementById('{!$Component.myform.entry.Patient_entry_section:pafname}').value;
            var slname=document.getElementById('{!$Component.myform.entry.Patient_entry_section:palname}').value;
            var sphone=document.getElementById('{!$Component.myform.entry.Patient_entry_section:paphone}').value;
            var semail=document.getElementById('{!$Component.myform.entry.Patient_entry_section:paemail}').value;
            var saddress1=document.getElementById('{!$Component.myform.entry.Demographic_entry_section:address1}').value;
            var saddresstype=document.getElementById('{!$Component.myform.entry.Demographic_entry_section:addresstype}').value;
            var scity=document.getElementById('{!$Component.myform.entry.Demographic_entry_section:city}').value;
            var sstate=document.getElementById('{!$Component.myform.entry.Demographic_entry_section:state}').value;
            var scountry=document.getElementById('{!$Component.myform.entry.Demographic_entry_section:country}').value;
            if(sfname!=''){
                if(!rname.test(sfname))
                ErrorText+="\n        First name must be start with Alphabates and allows only single space";
            }else{
                ErrorText+="\n        First Name is Required Field it must be Non-Empty";
            }
            if(slname!=''){
                if(!rname.test(slname))
                ErrorText+="\n        Last name must be start with Alphabates and allows only single space";
            }else{
                ErrorText+="\n        Last Name is Required Field it must be Non-Empty";
            }  
            if(sphone!=''&&(!rphone.test(sphone)))
                ErrorText+="\n        Phone number must contain 10 numbers";
            if(semail!=''&&(!remail.test(semail)))
                ErrorText+="\n        Invalid Email formate";
            if(saddress1=='')
                ErrorText+="\n        Address1 is Required Field it must be Non-Empty";
            if(saddresstype=='')
                ErrorText+="\n        Address Type is Required Field it must be Non-Empty";
            if(scity!=''&&(!rcity.test(scity)))
                ErrorText+="\n        City allows only Alphabets";
            if(sstate!=''&&(!rstate.test(sstate)))
                ErrorText+="\n        State allows only Alphabets";
            if(scountry!=''&&(!rcountry.test(scountry)))
                ErrorText+="\n        Country allows only Alphabets";
            if (ErrorText!= "") {
                alert("Error :" + ErrorText);
                return false;
            }
            else{
                alert("success");
                return true;
            }
                
       }
    </script>

It show alert messages.I need disply the javascript validation messages below the input field.please giveme explanation with an example.