• Nekosan
  • NEWBIE
  • 195 Points
  • Member since 2014

  • Chatter
    Feed
  • 6
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 46
    Replies
Hello,

I want to detect the pixel size of device currently being used.  

For example max pixel width of current diisplay is so and so.

 
  • March 23, 2015
  • Like
  • 0
I created a page and then added the page as the homepage on my site in Salesforce. When I click the link to the site, I get the message that says "authorization required: you must first log in or register.." How do I set the page to be viewed publicly so all can see it without logging in?

Thanks!
Summer
I have a custom button which uses a controller class to clone an opportunity.  I'd like it to only allow the clone if certain criteria are met but I am running into an issue that if the criteria are not met I receive an error saying
"Visualforce ErrorHelp for this Page
System.NullPointerException: Attempt to de-reference a null object
Error is in expression '{!cloneWithItems}' in component <apex:page> in page opportunity_clone: Class.OpportunityCloneWithItemsController.cloneWithItems: line 157, column 1"
that line is
return new PageReference('/'+newOpp.id+'/e?retURL=%2F'+newOpp.id);
I tried adding in
  if(newopp.id != null){
      return new PageReference('/'+newOpp.id+'/e?retURL=%2F'+newOpp.id);
        }else{
      ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, 'The Opportunity could not be cloned');
      ApexPages.addMessage(msg);
But then I get "Compile Error: Non-void method might not return a value or might have statement after a return statement."
I understand that the reason I'm getting the first error is that if my criteria are NOT met then there will be no newOpp so it will be null, but I'm not clear on why it won't allow me to add a .message or if there is a way to just change the error that users see when they've tried to use the button incorrectly.  I'd prefer they just see a standard error saying "This Opportunity Cannot be Cloned" instead of the whole VF page error that references the class.

Thanks so much,
Amanda
 
I am using this to achieve the backgroun in a <tr. tag on an embedded table. How can I make the white verticle lines on the cell borders the same background color to give the whole row a uniform look ?

input[type="text"]
{
color:red;
}

.red text {
color:red;
}

.gridtable{
background-color: #dedede;
border-color: #dedede;
}
</style>
........
<table id="t01" style="width:100%" >
<tr Class="gridtable">

Example of background with border lines.
we have a limited number of licenses in our full sandbox for service cloud and are hesitant to refresh in any short period of time. I created a simple javascript that would just take away who ever was testing with the license but the update does not seem to work. it queries correctly, just doesnt update
 
{!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")}
var ChangedUser = new sforce.SObject("User");
var CurrentUser = new sforce.SObject("User");

result = sforce.connection.query("select id,name from User where userpermissionssupportuser =true and isactive=true limit 1");
records = result.getArray("records");
if(records[0])
{
 for (var i=0; i< records.length; i++) {
    var record = records[i];
  if(confirm(record.Name +" has the license, do you really want to mess with them?")){
     ChangedUser.UserPermissionsSupportUser=false;
     ChangedUser.ID=record.id;
 try{    sforce.connection.update([ChangedUser]);
  }catch(er) {
alert(er);
}  
}
  }
}
window.location.reload();

Anyone have any thoughts on why that wouldn't update the user record?  I have the ability to manually update it.
trigger createSal on Employee__c (after insert, after update) {

       List<Salary__c> sal = new List<Salary__c>();

    for (Employee__c newEmp: Trigger.New) {
        if (newEmp.Name != null) {
            sal.add(new Salary__c(Id = newEmp.Id, Bonus__c=100,Monthly_Salary__c = 12000));
        }
    }
    insert sal;

}
Which function I can use to get following result?
If price is 5.457333333
it should show 5.46
I used setscale function .It does not show correct rounding .
How to display signature in PDF?Can I make use of Canvas?
In visualforce page its working with based64 but in PDF its not rendering at all. 
I don''t want to save it as attachment which is common solution I found everywhere. 

TIA
I am trying to display '©' on visualforce.I am using outputtext. Its showing garbage values. I tried using escape = false, still cannot see exact symbol on visualforce page. 
Is there any other tag which I can use to display special character ? 
I cannot see CurrencyISOCode field in workflow rule for update. Is there any easy way to update currencyISO on child same as parent(Other than trigger). I want to use standard field so that I can show currency symbol on the record. 

TIA.
Hello,

I want to detect the pixel size of device currently being used.  

For example max pixel width of current diisplay is so and so.

 
  • March 23, 2015
  • Like
  • 0
Hi,

In Visualforce,  I would like to create a link that goes directly to a list view we have created.  For example.  in SF1, right now the user clicks attendees, then can go through the different views and click 'Administrators'.  we want to skip the click attendees part, and just have Administrators and the other list views on the original VF page, but when I try referencing a specific list view, it shows up as an error.

Thanks,
I created a page and then added the page as the homepage on my site in Salesforce. When I click the link to the site, I get the message that says "authorization required: you must first log in or register.." How do I set the page to be viewed publicly so all can see it without logging in?

Thanks!
Summer
Hi All,

I am in need of some code snipet where i will be displaying a calender in vf page (Not Full page calender) and need to display all the events by week, month and the same will be displayed in mobile.

Regards
 
I have a custom button which uses a controller class to clone an opportunity.  I'd like it to only allow the clone if certain criteria are met but I am running into an issue that if the criteria are not met I receive an error saying
"Visualforce ErrorHelp for this Page
System.NullPointerException: Attempt to de-reference a null object
Error is in expression '{!cloneWithItems}' in component <apex:page> in page opportunity_clone: Class.OpportunityCloneWithItemsController.cloneWithItems: line 157, column 1"
that line is
return new PageReference('/'+newOpp.id+'/e?retURL=%2F'+newOpp.id);
I tried adding in
  if(newopp.id != null){
      return new PageReference('/'+newOpp.id+'/e?retURL=%2F'+newOpp.id);
        }else{
      ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, 'The Opportunity could not be cloned');
      ApexPages.addMessage(msg);
But then I get "Compile Error: Non-void method might not return a value or might have statement after a return statement."
I understand that the reason I'm getting the first error is that if my criteria are NOT met then there will be no newOpp so it will be null, but I'm not clear on why it won't allow me to add a .message or if there is a way to just change the error that users see when they've tried to use the button incorrectly.  I'd prefer they just see a standard error saying "This Opportunity Cannot be Cloned" instead of the whole VF page error that references the class.

Thanks so much,
Amanda
 
Hi, 

  I wrote a trigger on a custom object which will conterts data into Account Opportunity and Opportunity Products 

  It is converting into account and opportunity but not able to add products into opportunity product 

  String SOQLCloudProduct = deal.AP_Product__c; //Product Name
  CloudProduct = [SELECT ID FROM Product2 where name = :SOQLCloudProduct limit 1 ].ID; // To get Product ID 

   Above SOQL is not working please suggest me how to fix 

Complete trigger is 
 
trigger DealReg_To_Opportunity on DealReg__c (After Insert)
{
 // asyncApex.processOpportunity(Trigger.newMap.keySet());
 
     Set<Id> idSet = Trigger.newMap.keySet();

    Account acc = new Account();
    Opportunity opp = new opportunity();     
    List<OpportunityLineItem> oliList  = new List<OpportunityLineItem>();
    String Don = '00560000003W8gx';
    String Roger = '00560000004HPy1';
    String OppOwner;
    
    
  DealReg__c deal = [SELECT id, customer_name__c, deal_stage__c,
                            account_id__c, estimated_close_date__c,
                            estimated_value__c, competitor__c,
                            account__c, project_name__c,
                            distributor__c, reseller__c,
                            channel_source__c, discount_program__c,
                            ownerid, status__c, owner.type,
                            field_representative__c, theater__c,
                            Partner_Initiated__c,Partner_Led__c,K_12__c,Industry__c,Company_Url__c,Cloud_Deal_Registration__c,Product_Quantity__c,
                            Cloud_Product__c,Cloud_Service_Term__c,Cloud_Subscription_Term__c,
                            AP_Product__c,Service_Term__c,Subscription_Term__c
                        FROM DealReg__c
                        WHERE id = :idSet ];
 
 
 System.debug(LoggingLevel.INFO,'Start Testing my trigger');
  
 
  
  String Distributor;   
  String Region = deal.theater__c;
  
  /* Assign Opportunity owner */
  
  if ( Region == 'NAM') 
  {
     OppOwner  = '00560000004HPy1';
   }
  else if ( Region == 'EMEA')
  {   
     OppOwner = '00560000003W8gx';
   }
     
  
  /* Assign distributor */
  if ( deal.AP_Product__c <> NULL && deal.Service_Term__c <> NULL )                 
   {
   Distributor =  deal.distributor__c ;    
   }                     
  else if ( deal.Subscription_Term__c <> NULL && deal.theater__c == 'NAM'  ) 
   {
    Distributor = '0016000000pyLll'; // defaulting to westcon
   }
  else if ( deal.Subscription_Term__c <> NULL && deal.theater__c == 'EMEA'  )
   { 
   Distributor = '0016000000YmDkh'; //defaulting to zyko
   }

  System.debug(LoggingLevel.INFO,Distributor );

  If ( deal.Cloud_Deal_Registration__c == 'Yes') 
   {                        
  acc.name = Deal.customer_name__c;
  acc.Industry = Deal.Industry__c;
  acc.Website = Deal.Company_Url__c;
  acc.Type = 'Prospect';
                  
  Insert acc;                      
   
        opp.AccountId = acc.id;                     
        opp.name = Deal.project_name__c +  ' ' +'FOR'+' '+deal.customer_name__c;    
        opp.OwnerId = '00560000004HPy1';
        opp.discount_program__c = 'DEALREG/PI/PL';
        opp.Abbv_Discount_Program__c =  'DR/PI/PL';  
        opp.StageName = Deal.deal_stage__c;
        opp.CloseDate = Deal.estimated_close_date__c;   
        opp.Primary_Competitor__c = deal.competitor__c;
        opp.type = 'Existing Customer';
        opp.Government_Contract__c = 'None';
        opp.leadsource = 'Deal Registration';
        opp.Partner_Driven__c = 'yes';
        opp.Partner_Account__c = Distributor;
        opp.primary_distributor__c = Distributor;
        opp.primary_reseller__c = deal.reseller__c;
        opp.channel_source__c = deal.channel_source__c;
        opp.K_12__c  = deal.K_12__c;
        opp.Renewal_Opportunity__c = 'No';
        opp.Renewal_Incumbant_Reseller__c = 'No';
        opp.Renewal_K_12__c = 'No';    
        opp.DEALREG_SEND_QUOTE__c = 'Do Not Send';
        opp.RENEWAL_SEND_QUOTE__c = 'Do Not Send';  
        opp.Partner_Driven__c  = 'Yes';
        opp.Partner_Led__c = 'Yes';     
        opp.deal_registration__c = deal.id; 
        opp.Partner_Initiated_International__c = 'No';                      
   
   insert opp; 
   
    
    String priceBookName = 'Standard'; 
    String SOQLCloudProduct = deal.AP_Product__c;
	String SOQLCloudServiceTerm = deal.Service_Term__c;
	String SOQLCloudSubscription = deal.Subscription_Term__c; 
    String CloudProduct;
    String CloudServiceTerm;
    String CloudSubscription;
    
    if ( SOQLCloudProduct <> NULL )
    {
    CloudProduct = [SELECT ID FROM Product2 where name = :SOQLCloudProduct limit 1 ].ID;
    system.debug(CloudProduct);
    }   
    
    if ( SOQLCloudServiceTerm <> NULL ) 
    {
    CloudServiceTerm = [SELECT ID FROM Product2 where name = :SOQLCloudServiceTerm limit 1 ].ID;
    system.debug(CloudServiceTerm);
    }
    
    if ( CloudSubscription <> NULL ) 
    {
    
    CloudSubscription = [SELECT ID FROM Product2 where name = :SOQLCloudSubscription limit 1 ].ID;
    system.debug(CloudSubscription);
    }
    
    String CloudPricebookId;
    
    
    IF ( Region == 'NAM') 
    {
      CloudPricebookId = '01s60000000AKxZAAW';
    }
    ELSE IF ( Region == 'EMEA') 
    {
      CloudPricebookId = '01s60000000AKxUAAW';
    }  
      
    List<PricebookEntry>  pbeList  = new List<PricebookEntry>();
    
       
     pbeList = [Select ProductCode, UnitPrice, Product2Id, priceBook2Id From PricebookEntry 
                          where ( Product2Id = :CloudProduct or  Product2Id = :CloudServiceTerm or Product2Id = :CloudSubscription )
                                and priceBook2Id  = :CloudPricebookId];   
     
      system.debug(pbeList);
      
    for(PricebookEntry pbe: pbeList){
         OpportunityLineItem oli = new OpportunityLineItem();
        oli.OpportunityId = opp.id; 
        //oppprod.Product2 = pbe.Product2Id;
        //oppprod.ProductCode = pbe.Product2.ProductCode;
        oli.PricebookEntryId = pbe.id; 
        oli.Quantity = deal.Product_Quantity__c; 
        oli.UnitPrice = pbe.UnitPrice;
        oliList.add(oli);
      }  

   insert oliList;
   }
}

Thanks
Sudhir

 
Hi All,

I am trying to create a toggle slider using JQuery in vf page. As a result my entire page is disappering when i click the link. Someone guide me where it is going wrong..

<apex:page sidebar="false">
   <link rel="stylesheet" href="{!URLFOR($Resource.slider, '/css/style.css')}" type="text/css" media="screen" />
   <link rel="stylesheet" href="{!URLFOR($Resource.slider, '/css/slide.css')}" type="text/css" media="screen" />
   
   <script src="{!URLFOR($Resource.slider, '/js/jquery-1.3.2.min.js')}" type="text/javascript"></script>
   <script src="{!URLFOR($Resource.slider, '/js/slide.js')}" type="text/javascript"></script>
   <script src="https://code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
   
     <script> 
$(document).ready(function(){
    $(".button").click(function(){
        $("div").animate({
            height: 'toggle'
            
        });
    });
});
  </script>
<a href="javascript:void(0)" class="button" id="users_id">add as a friend</a>
<div style="background:#98bf21;height:100px;width:100px;position:absolute;"></div>
</apex:page>
Hello All,

I am trying to call a custom class from a link on the Account object using Execute JavaScript.  Ultimately I want to call the SecurityCheck class with a parameter of the account Id to instantiate the "sec" variable.  Then set the "show" variable to the results of sec.showPage().  I am doing something wrong here as I am not very good with JavaScript.  Once I have show = true || false then I will direct to one of two URLs.

My questions are:
1) How do I properly instantiate a variable in JavaScript by calling a class constructor with a parameter?
2) How do I then call a method of that class (class.showPage)?
3) Is there a better way to do this?  Like JS on the VF page that I am directing to?
 
{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/31.0/apex.js")}

try{
    var acct = '{!Account.Id}';
    var sec = sforce.apex.execute("SecurityCheck","SecurityCheck",{acct:acct});

    var show = sforce.apex.execute("SecurityCheck","sec.showPage",{});  

    //alert(show);
}
catch(err){
    var txt = "Error: ";
    txt+=err.description+" 11";
    alert(txt);
}

If (show == true) {
    window.open('ThisURL');
} else {
    window.open('ThatURL');
}

Thanks all for taking a look.
can we invoke batch apex in trigger?? and why we can or cannot.
  • December 02, 2014
  • Like
  • 0
How we can make a text field read only (none editable) (Standard field) in salesforce Standard Layout
Hello, I'd like to generate a report for Events grouped by Time, so I need to get Time from the field StartDateTime. I tried to do so but I can add custom field only to Activity (not to Event), where there is not StartDateTime. Do you have any suggestions? I cannot use APEX because I'm using a Professional Edition.

Thanks in advance.
Hi,
Is there a text area UI component available or any way to achieve it without using a raw textarea element?

Thanks
I am using this to achieve the backgroun in a <tr. tag on an embedded table. How can I make the white verticle lines on the cell borders the same background color to give the whole row a uniform look ?

input[type="text"]
{
color:red;
}

.red text {
color:red;
}

.gridtable{
background-color: #dedede;
border-color: #dedede;
}
</style>
........
<table id="t01" style="width:100%" >
<tr Class="gridtable">

Example of background with border lines.

Can any one plz tell me

how we can compare input field value with String on VF page.
we have a limited number of licenses in our full sandbox for service cloud and are hesitant to refresh in any short period of time. I created a simple javascript that would just take away who ever was testing with the license but the update does not seem to work. it queries correctly, just doesnt update
 
{!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")}
var ChangedUser = new sforce.SObject("User");
var CurrentUser = new sforce.SObject("User");

result = sforce.connection.query("select id,name from User where userpermissionssupportuser =true and isactive=true limit 1");
records = result.getArray("records");
if(records[0])
{
 for (var i=0; i< records.length; i++) {
    var record = records[i];
  if(confirm(record.Name +" has the license, do you really want to mess with them?")){
     ChangedUser.UserPermissionsSupportUser=false;
     ChangedUser.ID=record.id;
 try{    sforce.connection.update([ChangedUser]);
  }catch(er) {
alert(er);
}  
}
  }
}
window.location.reload();

Anyone have any thoughts on why that wouldn't update the user record?  I have the ability to manually update it.