• jha.pk5@cloud.com
  • NEWBIE
  • 0 Points
  • Member since 2011

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

Can anybody tell  how can i find General User permission setting in summer 12 . i went through profile and when i click any profile there is object setting,app setting Apec class access but i am not getting   any section for General user permission.Please tell me where can i get this.

Hi All,

 

I have one custom object Physician . My requirement is that when status is open i can insert new value, but when status is completed we can not insert new value just we can used old value.trigger is fire after update. can anybody help me to write this trigger.

 

 

 

Right now i m working on Google Map project. I need some useful link for pdf and coding related to apex and visual force.

How to print the values using trigger.new

How can we  get the current application name in vf page using controller.

How can we  get the current application name in vf page using controller

 

one global variable is in java script so i want to pass dat value in my controller
<apex:actionFunction name="saveCustName" action="{!saveCustomerName}" reRender="frmHome">
<apex:param name="custName" assignTo="{!customerName}" value=""></apex:param> how can i do this

trigger PhysicianVisit_AI_UpdateUnplannedCall on Physician_Visit__c (after Insert)
{
    
    
    if(Trigger.isInsert)
    {  
        try
        {
            if(clsPhysicianVisitUpdate.isInsert == false)
            {
                clsPhysicianVisitUpdate.isInsert =  true;
                clsUpdateFuturePhysicianVisits oclsUpdateFuturePhysicianVisits = new clsUpdateFuturePhysicianVisits();
                oclsUpdateFuturePhysicianVisits.updateFuturePhysicianVisits(trigger.new,'insert');
            
            }
        }
        catch(Exception e)
        {
            Trigger.New[0].addError('Error occurred in Updating future Physician Visits - ' + e);
        }
    }   
}

trigger users on User (before insert, before update) {

    if(Test.isrunningtest()) {
        system.debug('Allowing user create/edit.');
    } else {
        List<User> oUser = [SELECT Id, Security_user__c, ProfileId, UserName FROM User WHERE Id = :System.UserInfo.getUserId() LIMIT 1];
        If(oUser[0].UserName.endsWith('.dev10')){
          
            system.debug('IS DEV USER: Allowing user create/edit.');
        } else {
            Boolean isSecurityUser = oUser[0].Security_user__c;
            if(isSecurityUser) {
              
             
            } else {
                if(Trigger.isUpdate) {
                    List<Profile> list_pAdmin = [SELECT Id FROM Profile WHERE Name IN ('System Administrator','SL: System Administrator','SL: Sys Admin ','SL: Read Only Admin','SL: Read Only Admin Non ') LIMIT 5];
                    Set<String> set_pAdmin = new Set<String>();
                    for(Profile pAdmin : list_pAdmin) {
                        set_pAdmin.add(pAdmin.Id);
                    }
                    for(User oUserRec : Trigger.New) {
                        if((oUserRec.Id == System.UserInfo.getUserId()) && (!set_pAdmin.contains(oUser[0].ProfileId))) {
                            system.debug('IS THE USERS OWN RECORD AND THEY ARE NOT A SYS ADMIN: Allowing user create/edit.');
                        } else {
                            system.debug('IS NOT A TEST, DEV ENVIRONMENT, A SECURITY USER OR THE USERS OWN RECORD: Forbidding user create/edit.');
                            oUserRec .addError('You do not have permission to create or edit user records!');
                        }
                    }
                } else {
                    for(User oUserRec : Trigger.New) {
                        system.debug('IS NOT A TEST, DEV ENVIRONMENT, A SECURITY USER OR THE USERS OWN RECORD: Forbidding user create/edit.');
                        oUserRec .addError('You do not have permission to create or edit user records!');
                    }
                }
            }
        }
    }

}

trigger users on User (before insert, before update) {

    if(Test.isrunningtest()) {
        system.debug('Allowing user create/edit.');
    } else {
        List<User> oUser = [SELECT Id, Security_user__c, ProfileId, UserName FROM User WHERE Id = :System.UserInfo.getUserId() LIMIT 1];
        If(oUser[0].UserName.endsWith('.dev10')){
           
            system.debug('IS DEV USER: Allowing user create/edit.');
        } else {
            Boolean isSecurityUser = oUser[0].Security_user__c;
            if(isSecurityUser) {
               
              
            } else {
                if(Trigger.isUpdate) {
                    List<Profile> list_pAdmin = [SELECT Id FROM Profile WHERE Name IN ('System Administrator','SL: System Administrator','SL: Sys Admin ','SL: Read Only Admin','SL: Read Only Admin Non ') LIMIT 5];
                    Set<String> set_pAdmin = new Set<String>();
                    for(Profile pAdmin : list_pAdmin) {
                        set_pAdmin.add(pAdmin.Id);
                    }
                    for(User oUserRec : Trigger.New) {
                        if((oUserRec.Id == System.UserInfo.getUserId()) && (!set_pAdmin.contains(oUser[0].ProfileId))) {
                            system.debug('IS THE USERS OWN RECORD AND THEY ARE NOT A SYS ADMIN: Allowing user create/edit.');
                        } else {
                            system.debug('IS NOT A TEST, DEV ENVIRONMENT, A SECURITY USER OR THE USERS OWN RECORD: Forbidding user create/edit.');
                            oUserRec .addError('You do not have permission to create or edit user records!');
                        }
                    }
                } else {
                    for(User oUserRec : Trigger.New) {
                        system.debug('IS NOT A TEST, DEV ENVIRONMENT, A SECURITY USER OR THE USERS OWN RECORD: Forbidding user create/edit.');
                        oUserRec .addError('You do not have permission to create or edit user records!');
                    }
                }
            }
        }
    }

}

 

trigger users on User (before insert, before update) {

    if(Test.isrunningtest()) {
        system.debug('Allowing user create/edit.');
    } else {
        List<User> oUser = [SELECT Id, Security_user__c, ProfileId, UserName FROM User WHERE Id = :System.UserInfo.getUserId() LIMIT 1];
        If(oUser[0].UserName.endsWith('.dev10')){
           
            system.debug('IS DEV USER: Allowing user create/edit.');
        } else {
            Boolean isSecurityUser = oUser[0].Security_user__c;
            if(isSecurityUser) {
               
              
            } else {
                if(Trigger.isUpdate) {
                    List<Profile> list_pAdmin = [SELECT Id FROM Profile WHERE Name IN ('System Administrator','SL: System Administrator','SL: Sys Admin ','SL: Read Only Admin','SL: Read Only Admin Non ') LIMIT 5];
                    Set<String> set_pAdmin = new Set<String>();
                    for(Profile pAdmin : list_pAdmin) {
                        set_pAdmin.add(pAdmin.Id);
                    }
                    for(User oUserRec : Trigger.New) {
                        if((oUserRec.Id == System.UserInfo.getUserId()) && (!set_pAdmin.contains(oUser[0].ProfileId))) {
                            system.debug('IS THE USERS OWN RECORD AND THEY ARE NOT A SYS ADMIN: Allowing user create/edit.');
                        } else {
                            system.debug('IS NOT A TEST, DEV ENVIRONMENT, A SECURITY USER OR THE USERS OWN RECORD: Forbidding user create/edit.');
                            oUserRec .addError('You do not have permission to create or edit user records!');
                        }
                    }
                } else {
                    for(User oUserRec : Trigger.New) {
                        system.debug('IS NOT A TEST, DEV ENVIRONMENT, A SECURITY USER OR THE USERS OWN RECORD: Forbidding user create/edit.');
                        oUserRec .addError('You do not have permission to create or edit user records!');
                    }
                }
            }
        }
    }

}

Hi friends,

 

can any one help me how to write a test code for webservices.

 

for example,

 

global class CallYahooQuotes
{
@future(callout=true)
public static void getQuotes()
{ //for our simple example we are going to just update the quotes on one Account
Account acct = [select id, TickerSymbol, stock_price__c from account where name = 'Salesforce.com'];

//where f stands for the fields to be displayed (in this case: s - symbol; l1 - last price; c1 - change; d1 = last date)
// String url = 'http://quote.yahoo.com/d/quotes.csv?s='+acct.TickerSymbol+'&f=sl1c1d1&e=.csv';

String url = 'http://download.finance.yahoo.com/d/quotes.csv?s='+acct.TickerSymbol+'&f=l1&e=.csv';

Http h = new Http();

HttpRequest req = new HttpRequest();
req.setEndpoint(url);
req.setMethod('GET');

HttpResponse res = h.send(req);

//omitting error handling for example
acct.stock_price__c = decimal.valueOf(res.getBody().trim());
update acct;
}

}

 

Thanks,

Srikanth

Can anybody tell  how can i find General User permission setting in summer 12 . i went through profile and when i click any profile there is object setting,app setting Apec class access but i am not getting   any section for General user permission.Please tell me where can i get this.

Please tell me how to use this standard object practically with example From Home,chatter,compaign......to dashboard so that i can get some idea why they call standard objects and how to use them constructively .... i know at this level that account is for new account ... or Home object to see updations... But i want to understand practically (real example like a company first add new account for a customer than..... add its contact like this practical approach for all  standard objects) ..what is the relationship between them ( like we see these look up fields into next object like contact has account lookup) ... This is very useful for every new commer in this force Family.. Waiting for aboundant replies from all ...

 

please share your own practical use of these standard objects.

Hi,

Is it possible to creat e a new record for an object through visualforce page using standard contoller.

 

 

Hi, Please help on writing test case to get 100% code coverage . Lines in Red not covered

 

Here is the Apex class

 

public with sharing class TestFlighRequestPage {
    Test_Flight_Request__c fr;
     public List<Opportunity> listOpp;
     public String Id  {get; set;}
     private string result;
    
    public TestFlighRequestPage(ApexPages.StandardController stdController)
    {
        fr = (Test_Flight_Request__c)stdController.getRecord();
        
        if(fr.Id == null)
            Id = ApexPages.currentPage().getParameters().get('opp');
        else
            Id = fr.Opportunity__c;
        
        listOpp = [SELECT id ,Name, Departure_Date__c,Number_of_Passengers__c,Destination_Zone__c,Return_Date__c,
                    Origin_City__c,Destination_City__c,Flexibility_From__c,Flexibility_To__c
                 FROM Opportunity WHERE Id = :Id];
        
        if(listOpp.size() >0)
        {
            if(fr.Opportunity__c  == null)
            {
                fr.Opportunity__c  =  listOpp[0].Id;
            }
            if (fr.From__c == null)
            {
                fr.From__c = listOpp[0].Origin_City__c;
            }
            if (fr.To__c == null)
            {
                fr.To__c = listOpp[0].Destination_City__c;
            }
            if (fr.Outbound_del__c == null)
            {
                fr.Outbound_del__c = listOpp[0].Departure_Date__c;
            }
            if (fr.Pax_del__c == null)
            {
                fr.Pax_del__c = listOpp[0].Number_of_Passengers__c;
            }
            if (fr.Region_del__c == null)
            {
                fr.Region_del__c = listOpp[0].Destination_Zone__c;
            }
            if (fr.Inbound_del__c == null)
            {
                fr.Inbound_del__c = listOpp[0].Return_Date__c;
            }
            if (fr.Outbound_Flexibility__c == null)
            {
                fr.Outbound_Flexibility__c = listOpp[0].Flexibility_From__c;
            }
            if (fr.Inbound_Flexibility__c == null)
            {
                fr.Inbound_Flexibility__c = listOpp[0].Flexibility_To__c;
            }
        }
    }
    
    public PageReference Save()
    {
        try
        {
            if(fr.Id ==null)
                insert fr;
            else
                update fr;
        }
        catch(DmlException ex)
          {
                ApexPages.addMessages(ex);  
        }
        PageReference pr = new PageReference('/'+  Id);
        pr.setRedirect(true);
        return pr;
    }
    
    public PageReference SaveAndNew()
    {
        try
        {
            if(fr.Id ==null)
                insert fr;
            else
                update fr;
        }
        catch(DmlException ex)
        {
            ApexPages.addMessages(ex);  
        }
        PageReference pr = new PageReference('/' + Id);
        pr.setRedirect(true);
        return pr;
    }
   
     public void SendItineryEmail()
     {
          Http h = new Http();
         HttpRequest req = new HttpRequest();
        req.setEndpoint('http://itinerary.swiftsetup.com/ItineraryBuilder/GetCustomerView?opportunityId='+fr.Opportunity__c+'&flightRequestID='+fr.Id);
        req.setMethod('GET');
           
        HttpResponse res = h.send(req);
        result = res.getBody();
        String[] toaddress = new String[]{};
        toaddress.add('anil@swiftsetup.com');
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(toaddress);
        mail.setSubject('Flight Stat');
        mail.setHtmlBody(result);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
        
     }
    
     public PageReference CloneFlightRequest()
    {
        try
        {
            Test_Flight_Request__c clFR = new Test_Flight_Request__c();
            Test_Flight_Request__c oldFR = [SELECT From__c, To__c,Outbound_del__c,Pax_del__c,Region_del__c,        
                    Inbound_del__c,Outbound_Flexibility__c,Inbound_Flexibility__c,Opportunity__c,
                    Budget__c,Publish_Fare__c
                 FROM Test_Flight_Request__c WHERE Id = :fr.Id];

            clFR.From__c = oldFR.From__c;
            clFR.To__c = oldFR.To__c;
            clFR.Outbound_del__c = oldFR.Outbound_del__c;
            clFR.Pax_del__c = oldFR.Pax_del__c;
            clFR.Region_del__c = oldFR.Region_del__c;
            clFR.Inbound_del__c = oldFR.Inbound_del__c;
            clFR.Outbound_Flexibility__c = oldFR.Outbound_Flexibility__c;
            clFR.Inbound_Flexibility__c = oldFR.Inbound_Flexibility__c;
            clFR.Opportunity__c = oldFR.Opportunity__c;
            clFR.Budget__c = oldFR.Budget__c;
            clFR.Publish_Fare__c = oldFR.Publish_Fare__c;    
            insert clFR;
            
        }
        catch(DmlException ex)
        {
            ApexPages.addMessages(ex);  
        }
        PageReference pr = new PageReference('/' + Id);
        pr.setRedirect(true);
        return pr;
    }
}

Hi,

      I am planning to give admin certification in salesforce. Can anyone guide me as to how to go about the preparation,areas to focus upon, relevant study material(dumps) etc. Thanks in advance.

I am a system administrator and I need to know how to change the security settings in my sandbox so that I can generate Quote PDF files.

 

Currently when I click the Create PDF button for a quote, I get the following error:

 

Data Not Available You do not have Edit access to one of the two records you are trying to merge. Please contact your administrator to get additional access or merge the two record.

 

I can do this in production.   How can you what records or fields you do not have access to?

Now i got a question that make me dizzy, the old version of salesforce is normal to display the pdf which is generate by apex code,but now, the version has upgrade to summer12 and there is a proplem to display the pdf unless i remove the picture of pdf head(logo), can you tell me what's wrong with it or some new functions have published that i didn't know? thank you and hope you to give me the good idea!!
code:
<apex:page renderAs="pdf" >
 <apex:image id="theImage2" url="{!URLFOR($Resource.Images, 'header.jpg')}" width="210" height="50"/>
</apex:page>

  • May 15, 2012
  • Like
  • 0

Hi

 

Can I used 3rd party libraries within the Developer Force environment ?

 

For example, can I use jQuery ?

 

Thank you.

 

 

  • May 14, 2012
  • Like
  • 0

Hi,

 

In my organisation, we have VF page to create a new record for an object. It has 2 different record types. We have overridden the New button to open the VF page. This all works fine.

Now there is a requirement to add "Save & New" button in the VF page. I have written code to save and redirect to the record type selection page (hard coded the URL).

Save works fine and redirect is also working normally. But now when i select a record type and click on create, after that an error occurs " Broken URL error".

 

My code:

public PageReference save_New(){
         try {
            sController.save();
            PageReference pr = new PageReference(<URL given here>);
            pr.setRedirect(true);
            return pr;  
       } 
       catch(Exception e) {   
            ApexPages.addMessages(e);   
            return null;        
       }

 

What am i doing wrong here?

Alternatively, Is there a standard function for Save & New that I can use?

Any help would be appreciated.

 

Regards,

Jasleen

Hi All,

 

I have one custom object Physician . My requirement is that when status is open i can insert new value, but when status is completed we can not insert new value just we can used old value.trigger is fire after update. can anybody help me to write this trigger.

 

 

 

Hi one and All,

 

 

I have a project on google map and i need  some material and link and code which related to google in Apex and Vf page so that i have to implements in my project plz send ASAP.

 

  Thanks in aDVANCE.

 

Regards,

Rajesh.

trigger PhysicianVisit_AI_UpdateUnplannedCall on Physician_Visit__c (after Insert)
{
    
    
    if(Trigger.isInsert)
    {  
        try
        {
            if(clsPhysicianVisitUpdate.isInsert == false)
            {
                clsPhysicianVisitUpdate.isInsert =  true;
                clsUpdateFuturePhysicianVisits oclsUpdateFuturePhysicianVisits = new clsUpdateFuturePhysicianVisits();
                oclsUpdateFuturePhysicianVisits.updateFuturePhysicianVisits(trigger.new,'insert');
            
            }
        }
        catch(Exception e)
        {
            Trigger.New[0].addError('Error occurred in Updating future Physician Visits - ' + e);
        }
    }   
}

trigger users on User (before insert, before update) {

    if(Test.isrunningtest()) {
        system.debug('Allowing user create/edit.');
    } else {
        List<User> oUser = [SELECT Id, Security_user__c, ProfileId, UserName FROM User WHERE Id = :System.UserInfo.getUserId() LIMIT 1];
        If(oUser[0].UserName.endsWith('.dev10')){
          
            system.debug('IS DEV USER: Allowing user create/edit.');
        } else {
            Boolean isSecurityUser = oUser[0].Security_user__c;
            if(isSecurityUser) {
              
             
            } else {
                if(Trigger.isUpdate) {
                    List<Profile> list_pAdmin = [SELECT Id FROM Profile WHERE Name IN ('System Administrator','SL: System Administrator','SL: Sys Admin ','SL: Read Only Admin','SL: Read Only Admin Non ') LIMIT 5];
                    Set<String> set_pAdmin = new Set<String>();
                    for(Profile pAdmin : list_pAdmin) {
                        set_pAdmin.add(pAdmin.Id);
                    }
                    for(User oUserRec : Trigger.New) {
                        if((oUserRec.Id == System.UserInfo.getUserId()) && (!set_pAdmin.contains(oUser[0].ProfileId))) {
                            system.debug('IS THE USERS OWN RECORD AND THEY ARE NOT A SYS ADMIN: Allowing user create/edit.');
                        } else {
                            system.debug('IS NOT A TEST, DEV ENVIRONMENT, A SECURITY USER OR THE USERS OWN RECORD: Forbidding user create/edit.');
                            oUserRec .addError('You do not have permission to create or edit user records!');
                        }
                    }
                } else {
                    for(User oUserRec : Trigger.New) {
                        system.debug('IS NOT A TEST, DEV ENVIRONMENT, A SECURITY USER OR THE USERS OWN RECORD: Forbidding user create/edit.');
                        oUserRec .addError('You do not have permission to create or edit user records!');
                    }
                }
            }
        }
    }

}