• Darshan Shah2
  • NEWBIE
  • 135 Points
  • Member since 2014

  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 31
    Replies
I am new to the Javascript with salesforce. 

<apex:page controller="changecolorusingjs"  >
<script>
function onclick()
{
  var x,text; 
   x=document.getElementById('out').value; 
    x.style.color="blue";  
     if(x!=null)
      {
         name="acc.name";
      }
   
   document.getElementById('ou').innerHTML=name;
 }    
    </script>

 <apex:form id="d" >
  <apex:pageBlock >
  <apex:pageBlockSection id="out" >
    <apex:inputField value="{!acc.name}" required="false"/>
    <apex:inputField value="{!acc.phone}"/>
    <apex:commandButton value="click" action="{!click}" onclick="onclick" reRender="d"/>
  </apex:pageBlockSection>
  <apex:outputPanel id="ou">
  
  </apex:outputPanel>
  </apex:pageBlock>
 </apex:form>
</apex:page>
Hi Folks,

But when i am clicking on button popup have not displayed. Please go through below code. Thanks in advance.

VF Page:

<apex:page controller="popup4" >
<style type="text/css">

.popup  
  {  
  background-color: orange;  
  border-width: 2px;  
  border-style: solid;  
  z-index: 9999;  
  left: 50%;  
  padding:10px;  
  position: absolute;  
  width: 400px;  
  margin-left: -250px;  
  top:80px;  
  }  
</style>
 <apex:form >
  <apex:pageBlock >
   <apex:pageBlockTable value="{!details}" var="ac">
    <apex:column value="{!ac.name}"/>
    <apex:column value="{!ac.phone}"/>
    
<apex:column headervalue="Details">
    <apex:commandButton value="Edit" action="{!edit}" />
    <apex:param name="id" value="{!ac.id}" assignTo="{!aid}"/>
    </apex:column>
    <apex:outputPanel >
    <apex:outputPanel styleClass="popup" rendered="{!displaypopup}"/>
    <apex:outputField value="{!ac.name}"/>
        <apex:outputField value="{!ac.phone}"/>
            <apex:outputField value="{!ac.Email__c}"/>
    </apex:outputPanel>
    </apex:pageBlockTable>
    </apex:pageBlock>
    </apex:form>
   </apex:page>

Apex Class:

public with sharing class popup4 {

    public String aid { get; set; }
    public boolean displaypopup{set;get;}
    public list<account>acct{set;get;}
    
    public PageReference edit() 
    {
         displaypopup=true;
         string aid=apexpages.currentpage().getparameters().get('id');
         acct=[select id,name,phone,email__c from account where id=:aid];
         return null;
    }

  public list<account>details{set;get;}
    
    public popup4()
    {
     
     details=[select name,phone from account];
     }
}
Hi,

If I click in the column, the column is green, but the action is not working anymore. Could you help me to solve the problem.
If I click another account, the colum is also green, it is possible to reset the column before to blank?

Thanks,
Sascha
 
<apex:pageblock id="pbAcc">
<apex:outputpanel style="overflow:scroll;height:200px;" layout="block">
    <apex:pageblocktable value="{!AccList}" var="Acc">
        <apex:column headervalue="Name" onclick="this.style.backgroundColor='green'">
     <apex:outputField value="{!Acc.Name}"/>
            <apex:actionSupport event="onclick" action="{!fetchOpps}" rerender="pbOpp">
                <apex:param assignTo="{!SelectedAccountId}" value="{!Acc.Id}" name="SelectedAccountId"/>
            </apex:actionSupport>
        </apex:column>        
        <apex:column headervalue="Street">
            <apex:outputfield value="{!Acc.BillingStreet}" />
        </apex:column>
        <apex:column headervalue="City">
            <apex:outputfield value="{!Acc.BillingCity}" />
        </apex:column>
    </apex:pageblocktable>   
</apex:outputpanel>
</apex:pageblock>

 
Hi All,

I'm trying to display all the files of all the Groups to which a user belongs to.

i.e, if the user is a member of GroupA and GroupB, then I have to display all the files which belong to GroupA and all the files which belong to GroupB.

This is similar to 'FILES IN MY GROUPS' section in the standard Files tab.

Currently I am trying to use the 'ContentDocumentLink' object as shown below:
select Id,ContentDocument.title,ContentDocument.LastViewedDate,ContentDocumentId,ContentDocument.LastModifiedDate from ContentDocumentLink where LinkedEntityId =:groupId

Using the above query I can get all the files which belong to the group referred by the groupId variable.
When I try to query by giving a set of ids for 'LinkedEntityId' field in the where condition, then I'm getting an error saying that only a single id, ContentDocumentid or LinkedEntityId should be used with an equals operator.

Is there any other object that can be used for this? Or should the above query be changed?
So how can I get a list of documents which belong to a list of groups?
Need some help on this please.

Thanks,
Anu
 
Hi,

In Custom Visualforce Delete page for multiple records, when click on Delete link that recordID is not passing to controller. 

For Single record Delete link is working , here recordID is passing to controller(passing recordid through url).

But for Multiple records when click on Delete link the recordid is not passing to controller. 

please help on the issue.

Visualforce page:
<apex:page standardController="contact" extensions="deletemultiplecont" recordSetVar="contacts" >
    <apex:form >
          <apex:pageblock >
         
           <table class="list " border="0" cellpadding="0" cellspacing="0">
           <tr class="headerRow" >
              
              <th class="headerRow"> Action </th>
              <th class="headerRow"> Name </th>
              <th class="headerRow"> MailingCity </th>
              <th class="headerRow"> Phone </th>
           </tr>
          <th> <apex:repeat value="{!contacts}" var="cont">
           <tr class="dataRow">
               
                <td class="dataCell"> <apex:commandlink value="delete" action="{!delmultplerec}"> 
                   <apex:param value="{!cont.id}" assignTo="{!asgn}"/> 
                 </apex:commandLink> </td>
               
              <td class="dataCell"> <apex:outputText value="{!cont.Name}"/> </td>
              <td class="dataCell"> <apex:outputText value="{!cont.MailingCity}"/> </td>
              <td class="dataCell"> <apex:outputText value="{!cont.phone}"/> </td>  
             
           </tr>
           </apex:repeat> </th>
           
        </table>
                 
      </apex:pageblock>
    </apex:form>

</apex:page>

Apex:

Public with sharing class deletemultiplecont
{
  public string Name{set;get;}
  public string Phone{get;set;}
  public string MailingCity{get;set;}
  public string asgn{get;set;}
  public contact cdel = new contact();
 
 public deletemultiplecont(apexpages.standardsetcontroller setcon)
  {
  
  }
  
  Public pagereference delmultplerec()
  {
      
        system.debug('hidden val is..!!' +asgn);
        try
            {
            
            cdel = [select id from contact where id =: asgn];
            system.debug('delete rec is..!!' +cdel);
            delete cdel;            
            return NULL;
            }
             catch(exception e)
             {
                System.debug('The following exception has occurred: ' + e.getMessage());
                return NULL;
             } 
  }
}

Hi,

I am trying to configure a send with docusign button and this is where i am till now with the error that is shown in the subject.

Below is my code, please advise.
 

{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
var RQD = DSGetPageIDFromHref();
var SourceID = "{!Lead.Id}";
var CRL = "LoadDefaultContacts~0";
var LA = "0";
var RC = "";
window.location.href = "/apex/dsfs__DocuSign_
CreateEnvelope?DSEID=0&RQD="+RQD+"&SourceID="+SourceID+"&CRL="+CRL+"&LA="+L
A+"&RC="+RC;

Thanks,

Darko

Hi,

I need help on the following requirement as follows

1) I am having a custom field called as sub status_c in my custom object Teamform__c , when the sub status picklist value changes i need to calculate the ttime difference between old sub status and new sub status vaule change


i have created 3 fields as follws

Old_Time__c -> Date/Time data type
New_Time__c -> Date/Time data type

Days_Difference__c -> days difference

but it is not updating the value in the field

i am getting the below error

Sandbox
 
Sandbox
 
Apex script unhandled trigger exception by user/organization: 005U0000000HH3g/00Dq00000009WJY Source organization: 00DU0000000HiA8 (null)
TeamformTriggertime: execution of BeforeUpdate
 
caused by: System.NullPointerException: Attempt to de-reference a null object
 
Trigger.TeamformTriggertime: line 18, column 1



Let me know if i am doing anything wrong in my trigger

MY TRIGGER CODE :


trigger TeamformTrigger on Team_Form__c (before insert,before update) {
List<Team_Form__c> Teamform = new List<Team_Form__c>();
   if(Trigger.isbefore){
      if(Trigger.isInsert){
         for(Team_Form__c team:Trigger.new){
             Datetime dt = DateTime.newInstance(Date.today(), Time.newInstance(0, 0, 0, 0));
             String dayOfWeek=dt.format('EEEE');
             System.debug('Day : ' + dayOfWeek);
             if((dayOfWeek!='Saturday' || dayOfWeek!='Saturday') && (team.SubStatus__c!=null || team.SubStatus__c!=''))
               team.Old_Time__c=System.now();
         }
      }
      if(Trigger.isUpdate){
         for(Team_Form__c teams:Trigger.new){
             Datetime dt = DateTime.newInstance(Date.today(), Time.newInstance(0, 0, 0, 0));
             String dayOfWeek=dt.format('EEEE');
             System.debug('Day : ' + dayOfWeek);
             Date convertCreatedDate = date.newinstance(Trigger.oldMap.get(teams.Id).Old_Time__c.year(), Trigger.oldMap.get(teams.Id).Old_Time__c.month(), Trigger.oldMap.get(teams.Id).Old_Time__c.day());
             if((Trigger.oldMap.get(teams.Id).SubStatus__c!=Trigger.newMap.get(teams.Id).SubStatus__c) &&
               (teams.SubStatus__c!=null || teams.SubStatus__c!='') && (dayOfWeek!='Saturday' || dayOfWeek!='Saturday')){
                 Integer dateDifference = System.today().daysBetween(convertCreatedDate);
                 teams.New_Time__c=System.now();
                 teams.Days_Difference__c=dateDifference;
            }
         }
      }
   }
}



Kindly help me on this regard

Thanks in Advance



 
We're having a strange situation, kinda hard to follow up.

We have two validation rules on Accounts, basically they validate if a calculus over a value results in the second value.

On accounts we use two recordtypes, and each recordtype has its corresponding validation rule to evaluate.

Also, the fields evaluated in each validation rule are different, and are only shown in their respective page layout.

For some users, both validation rules are being evaluated, thus failing the account creation.

This are the validation rules:
 
IF( RecordType.Name = "Cuenta personal",
IF (
CASE( (11 - ( Validacion_RUT_1_Persona__c - Validacion_RUT_2_Persona__c )) , 1,"1",2,"2",3,"3",4,"4",5,"5",6,"6",7,"7",8,"8",9,"9",10,"K",11,"0", "ERROR" )
= mid ( Rut_contacto__pc & "-" & UPPER(DV_contacto__pc) , len(Rut_contacto__pc & "-" & UPPER(DV_contacto__pc)) , 1 )
, FALSE, TRUE )
,FALSE)
IF ( RecordType.Name = "Cuenta Corporativa",
IF (
CASE( (11 - ( Validacion_RUT_1__c - Validacion_RUT_2__c )) , 1,"1",2,"2",3,"3",4,"4",5,"5",6,"6",7,"7",8,"8",9,"9",10,"K",11,"0", "ERROR" )
= mid ( Rut__c & "-" & UPPER(DV__c) , len(Rut__c & "-" & UPPER(DV__c)) , 1 )
, FALSE, TRUE )
,FALSE)
My guess and analysis shows that always both validation rules, irregardless of the recordtype, are evaluated, and given that the fields in one of them are empty the validation fails, halting the creation process.

But that doesn't explain how most of our users don't have this problem and only a handful are experiencing this.

I've tried with all the browsers, both POSTs send the recordtypeid, and a coworker right next to me, filling the fields and saving the account, entering the same values as i did, created the account successfully.

Should i create a case for this?

Thanks in advance
Hi All,

I'm getting a null value on a lookup field when running a test class.
 
Account a = new Account(Name = '1', Owner = u, CurrencyIsoCode = 'CAD');
        insert a;
		a = [SELECT id, AccountNumber, Name, CurrencyIsoCode, Related_Billing_Contract__c FROM account WHERE id = :a.id];

		Billing_Contract__c bc = new Billing_Contract__c(Account__c = a.id, Active__c = TRUE, Annual_Increase_Amount__c = 0.03, Billing_Frequency__c = 'Annually');
		insert bc;
		bc = [SELECT id FROM Billing_Contract__c WHERE id = :bc.id];

		a.Related_Billing_Contract__c = bc.id;
		update a;

		a = [SELECT id, AccountNumber, Name, CurrencyIsoCode, Related_Billing_Contract__c FROM account WHERE id = :a.id];

		System.debug('Related_Billing_Contract__c: ' + a.Related_Billing_Contract__c);
        
        Opportunity o = new Opportunity(Name = '2', GSS_Rep__c = g.id, Account = a, StageName = 'No Status', CloseDate = System.today(), Amount = 1, Type = 'New Implementation', License_Model__c = 'Perpetual', Owner = u, Sales_Rep2__c = s.id, Pricebook2Id = p.id, CurrencyIsoCode = 'CAD', Intall_Date_Opp__c = system.today(), Milestone_Trigger__c = 'Installation', Payment_Terms_Drop__c = '30 Days on Order');
        insert o;

        o = [SELECT id, AccountId, Account.AccountNumber, Account.Related_Billing_Contract__c, Account.Name, Name, Service_Value_No_Milesotne__c, CurrencyIsoCode, Software_Value_No_Milestone__c, Account.Id, Account.Licensing_Model__c, type, Service_Days__c FROM opportunity WHERE id = :o.id];

        System.debug('o.account.Related_Billing_Contract__c: ' + o.Account.Related_Billing_Contract__c);

My initial Debug returns an ID for the Account.Related_Billing_Contract__c, but when I go through the Opportunity to find the same value (Opportunity.Account.Related_Billing_Contract__c) I am getting NULL returned. Any help?
Here's my code I'm trying to use but I was only given the code for one user.  I don't know what changes I need to make to have this work for multiple users. I'm not a programmer and would love some help!  Thank you!


<apex:page action="{!if($User.Alias !='user1,user2,user3,user4,user5',
                    null,
                    urlFor($Action.Lead.Delete, $CurrentPage.Parameters.id, [retURL='/00Q'], true)
                    )
                    }" standardController="Lead">
   <apex:pageBlock >
     <apex:PageMessage summary="You are not allowed to delete Leads. Please contact your Field Marketing Manager for assistance." severity="Warning" strength="3"/>
     <apex:pageMessages />
   </apex:pageBlock>
</apex:page>
Hi,
I am using one custom list button on one of the related list. But sometime when I click on this button I am getting the below error message:
A problem with the OnClick javascript for this button or link was encountered: Failed to execute send on 'XMLHttprequest': Failed to load 'https://cs21.salesforce.com/services/Soap/u/29.0'.

One thing to note here is that this error message is not coming all the time. But I need to fix this one. Below is my JS code for this button:

{! REQUIRESCRIPT("/soap/ajax/24.0/connection.js")}
var RecordTypeQuery = "Select Id from RecordType where developername='Set_Up_Plan' and SObjectType='Activity_Plan__c'";
var recordtype= sforce.connection.query(RecordTypeQuery );
var records = recordtype.getArray("records");
window.open("/{!$Setup.Org_Level_Settings__c.Activity_Plan_Prefix__c}/e?CF{!$Setup.Org_Level_Settings__c.Activity_Plan_ICP_Field_Id__c}={!JSENCODE(Account.Name)}&CF{!$Setup.Org_Level_Settings__c.Activity_Plan_ICP_Field_Id__c}_lkid={!Account.Id}&RecordType="+records[0].Id+"&retURL={!Account.Id}","_parent");

Any help is much appreciated. Thanks in advance.
Hi Experts,
 
We are using "Project" and "Charge Code" Custom objects.
We create projects and for each project 10 charge codes common.
Our end user after creation of project, he manually adds 10 charge codes to project.

Scenario: After creation of project automatically those ten charge code records added to project record.

Please find below is Project record with charge code records.

Project Record
 
Thanks,
Manu
I am new to the Javascript with salesforce. 

<apex:page controller="changecolorusingjs"  >
<script>
function onclick()
{
  var x,text; 
   x=document.getElementById('out').value; 
    x.style.color="blue";  
     if(x!=null)
      {
         name="acc.name";
      }
   
   document.getElementById('ou').innerHTML=name;
 }    
    </script>

 <apex:form id="d" >
  <apex:pageBlock >
  <apex:pageBlockSection id="out" >
    <apex:inputField value="{!acc.name}" required="false"/>
    <apex:inputField value="{!acc.phone}"/>
    <apex:commandButton value="click" action="{!click}" onclick="onclick" reRender="d"/>
  </apex:pageBlockSection>
  <apex:outputPanel id="ou">
  
  </apex:outputPanel>
  </apex:pageBlock>
 </apex:form>
</apex:page>
Hello,

I have a usecase where,
I want to build the SQL query in string format.
and get the result in List.

Presently,
String skill = 'Skill1';
List<ProfileSkillUser> tempResult = [SELECT User.FirstName, User.LastName, ProfileSkill.Name, EFX_Skill_assessment__c FROM ProfileSkillUser WHERE ProfileSkill.Name like :skill];

In future,
String skill = 'Skill1';
String query = "SELECT User.FirstName, User.LastName, ProfileSkill.Name, EFX_Skill_assessment__c FROM ProfileSkillUser WHERE ProfileSkill.Name like :skill";
List<ProfileSkillUser> tempResult = Execute(query);

How can i achieve this ?


I tried to follow two things,
https://developer.salesforce.com/page/Secure_Coding_SQL_Injection
http://use-the-index-luke.com/sql/myth-directory/dynamic-sql-is-slow
query = "select * from users where user = '" +
      Request.form("user") + "' and password = '" +
      getSaltedHash(Request.form("password")) + "'";

queryResult = Database.executeQuery(query);

 
hi iam trying to group name  and order by period but giving above error how can i do that
my query is:
list<Agreement1__c> al = [select Name,driver__C,period__C,sales__c,quantity__c from Agreement1__C group By Name order by period__c ];
please tell me how can delete that error
 
Hi Folks,

But when i am clicking on button popup have not displayed. Please go through below code. Thanks in advance.

VF Page:

<apex:page controller="popup4" >
<style type="text/css">

.popup  
  {  
  background-color: orange;  
  border-width: 2px;  
  border-style: solid;  
  z-index: 9999;  
  left: 50%;  
  padding:10px;  
  position: absolute;  
  width: 400px;  
  margin-left: -250px;  
  top:80px;  
  }  
</style>
 <apex:form >
  <apex:pageBlock >
   <apex:pageBlockTable value="{!details}" var="ac">
    <apex:column value="{!ac.name}"/>
    <apex:column value="{!ac.phone}"/>
    
<apex:column headervalue="Details">
    <apex:commandButton value="Edit" action="{!edit}" />
    <apex:param name="id" value="{!ac.id}" assignTo="{!aid}"/>
    </apex:column>
    <apex:outputPanel >
    <apex:outputPanel styleClass="popup" rendered="{!displaypopup}"/>
    <apex:outputField value="{!ac.name}"/>
        <apex:outputField value="{!ac.phone}"/>
            <apex:outputField value="{!ac.Email__c}"/>
    </apex:outputPanel>
    </apex:pageBlockTable>
    </apex:pageBlock>
    </apex:form>
   </apex:page>

Apex Class:

public with sharing class popup4 {

    public String aid { get; set; }
    public boolean displaypopup{set;get;}
    public list<account>acct{set;get;}
    
    public PageReference edit() 
    {
         displaypopup=true;
         string aid=apexpages.currentpage().getparameters().get('id');
         acct=[select id,name,phone,email__c from account where id=:aid];
         return null;
    }

  public list<account>details{set;get;}
    
    public popup4()
    {
     
     details=[select name,phone from account];
     }
}
I am trying to create a google chart image into a visualforce page and have it pull information from a field on the account page.  Here is my script.  I am using a field called "Variance_by_Percentage__c" I am trying to use an in image of
User-added image

<apex:page standardController="Account">
  <head>
  <script type='text/javascript' src='https://www.google.com/jsapi' />
  <script src="/soap/ajax/19.0/connection.js" type="text/javascript" />
 
  <script type="text/javascript">
 
 
    google.load("visualization", "1", {packages:["corechart"]});
    google.setOnLoadCallback(drawChart);
 
    function drawChart() {
        // Create a new data table with two columns: the label and the value
       var data = google.visualization.arrayToDataTable([
              ['Title', 'Value'],
              ['', 0]

          ]);
             var options = {
              width: 600,
              height: 320,
            greenFrom: -5,
             greenTo: 5,
              min: -20,
              max: 20,
              majorTicks: [-20, -15, -10, -5, 0, 5, 10, 15, 20],
          };
 
        // We need the sessionId to be able to query data
        sforce.connection.sessionId = '{!$Api.Session_ID}';
        // Query data using SOQL.
        var result = sforce.connection.query("SELECT Id, Variance_by_Percentage__c FROM Account");
        // Iterate over the result
        var it = new sforce.QueryResultIterator(result);
        while(it.hasNext()) {
            var record = it.next();
            // Add the data to the table
            data.addRow([record.productFamily, {v:parseFloat(record.sales), f: formatCurrencyLabel(record.sales)}]);
        }
        var chart = new google.visualization.Gauge(document.getElementById('chart_div'));
        chart.draw(data, options);

          setInterval(function () {
              data.setValue(0, 1, 40 + Math.round(60 * Math.random()));
              chart.draw(data, options);
          }, 13000);
          setInterval(function () {
              data.setValue(1, 1, 40 + Math.round(60 * Math.random()));
              chart.draw(data, options);
          }, 5000);
          setInterval(function () {
              data.setValue(2, 1, 60 + Math.round(20 * Math.random()));
              chart.draw(data, options);
          }, 26000);

    };
 
  </script>
  </head>
  <div id="chart_div" />
</apex:page>