• sunny522
  • NEWBIE
  • 331 Points
  • Member since 2013

  • Chatter
    Feed
  • 10
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 124
    Replies
HI all
   Im new to salesforce . i want to write  a trigger  when ever Email/ phone of the account  is updated ,all the contact email should be same. any one help me to solve 

Thank you
Harsha
  • August 18, 2019
  • Like
  • 0
Hi All,

Could please help me in covering if else conditions in test class for below void method. Thanks in advance.

public void nextDateView() {
        if(defaultDateView.equalsIgnoreCase('Month')){
            startDate = startDate.addMonths(1);
            endDate = endDate.addMonths(1);
        }
        else if(defaultDateView.equalsIgnoreCase('Week')){
            startDate = startDate.addDays(7);
            endDate = endDate.addDays(7);
        }
        else if(defaultDateView.equalsIgnoreCase('Day')){
            startDate = startDate.addDays(1);
            endDate = endDate.addDays(1);
        }

 

Hello Guys,

I have created a trigger on contact that insert a new opportunity. It is working properly but when we perform bulk operation then it's giving the error CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: OpportunityCreatorOnContact: System.LimitException: Too many SOQL queries: 101 

See the trigger below and please provide me the solution for it

trigger OpportunityCreatorOnContact on Contact (before update) {
   
    if(OpportunityCreatorOnContactHandler.isFirstTime){
        OpportunityCreatorOnContactHandler.isFirstTime=false;
  
       List<Contact> ContList = new List<Contact>([SELECT Name,Contact.Account.Id,Contact.Account.Name, Most_recent_Opportunity_Stage__c, Contact.Account.OwnerId,Quarantine__c,mkto71_Lead_Score__c from Contact where id IN :Trigger.newMap.keySet()]); 
                for(Contact c : trigger.new)
                {   
                    for(Contact c1: ContList){  

                      if(c.Most_recent_Opportunity_Stage__c=='Closed Lost' && trigger.oldMap.get(c.Id).Create_New_Opp__c==false && c.Create_New_Opp__c==true  && c.mkto71_Lead_Score__c>=100 ) {   
                        
			Opportunity opp = new Opportunity(Name=c1.Account.Name, AccountID=c.AccountId, StageName='Open', CloseDate=Date.Today().addDays(+30),ownerID = c1.Account.OwnerId);
                        insert opp;
                      	
			opportunityCOntactRole oppCOn = new opportunityCOntactRole(OpportunityId=opp.id, contactId= c.Id, isPrimary=true);
                      	insert oppCon;

                      }    
                  }    
                }     

                        
          }    
}
Thanks

 

 

 

 

Hi

I have a requirement where user can match diffrent say A's to B's in a pageBlockTable with a button , I just want to highlight which Match was selected .
Currently it does that but when u make a different selection that to gets highlighted , I want original one to return in previous color.
PPPHEWWWWWWWWWW...
not working guyzz pls help
code is :

<style>
.selectedDataRow {
    background-color: skyblue;
}
.normal{
   
}
</style>
<script>
function updateRowColor(row) {
    if(row.className.indexOf(' selectedDataRow') < 0) {
        row.className = row.className + ' selectedDataRow'
    } else {
        classes = row.className.split(' ')
        for(var x in classes) {
            if(classes[x] == 'selectedDataRow') {
                classes[x] = classes[0]
                classes.shift()
            }
        }
        row.className = classes.join(' ')
    }
}
</script>


PAGE :

<apex:pageBlock title="Care Receivers">
       <apex:pageBlockTable value="{!ReceiverAvail}" var="cr" border="1" onRowClick="updateRowColor(this)">
           <apex:column value="{!cr.Name}" />
           <apex:column value="{!cr.Phone}"/>
           <apex:column value="{!cr.PersonEmail}"/>
           <apex:column value="{!cr.Primary_Services_Needed__c}"/>
           <apex:column value="{!cr.Secondary_Services_Needed__c}"/>
           <apex:column value="{!cr.CR_Family_smokes_inside_the_home__c}"/>
           <apex:column value="{!cr.CR_has_pet__c}"/>
           
           <apex:column >
               <apex:commandButton value="Match" reRender="myPageBlockPanel,assignPanel,volAssignPb" action="{!match}">
               <apex:param name="crId" assignTo="{!crId}" value="{!cr.Id}" />
               </apex:commandButton>
           </apex:column>
       </apex:pageBlockTable>
   </apex:pageBlock>
Hi,

I am looking to disable couple of fields when I launch my Visual Force Page from a Custom Button, can I get som help in terms of a sample code ?  I know this is basic but am new to Apex and Visual Force. Appreciate the help

Thanks
SC
Hi All,

I am learning salesforce from a month time now, i am  not so clear with permission sets.
As i had gone through some documents on web i got the information that permission sets  are used  giving some additional permission like acess to fields rather than changing profiles all the time.

My first question is, are the permission sets only used for granting acess to fields that profiles restrict them not to ? is this the only use? are they any more useful cases where we can use the permission sets?

On the other side, i tried to grant "edit " functionality on a custom object in recruting application using permissin sets to a profle where it has only read and creat . however the granted permission was not working as the profile  restricted  them to read and create. so this leaves me to conclude that profile settings cannot be superced by permision sets . Am i correct here ?

Please let me if i in right direction.


Thanks for your inputs.
Regards,
Raj
Declare and populate array of string containing month names viz. January, February
Hi, 

We are doing an Integration using SOAP services.

For that, third party gave us SSL certificate in .pfx format along with password. I have doubt that how to use that certificate in our Request.  I opened that certificate and used the content of it in my code and I got ' No Certificate found' Error. How can I resolve this issue.  May I know the Procedure to Integrate using SOAP services.


I'm using VisualForce page to generate pdf, has anyone successfully added footer to pdf?

 

I've tried the solution below by using @page stylesheet, but with no luck, the footer element is basically disappeared.

http://help.salesforce.com/apex/HTViewSolution?id=000003705&language=en_US

 

 

  • November 18, 2013
  • Like
  • 0
Hi,
   I need to send attachment to jira from salesforce using Rest api.I am getting response as 200 but attachment was not there.I think there is some issue with attachment content.Can anyone help me with sample code
 
Hi ,
I am able to send email using sendemail method.In order to send email with attachments I think we need to use SendRawEmail method.,I used sendrawEmail method .I am getting response as 200 but I didn't receive any emails/attachments.Can anyone provide a sample code for this?
Third party tool will send response  to url which we provide.It is asking to provide secure end point url.How can i create secure endpoint url in salesforce?
Can we update any field  through trigger if insertion of record fails?
I kept an error when a record with duplicate email exists through adderror in trigger.so when a duplicate lead is creating it will prevent with error.At the same time I want to update a field in already existing lead.How can I achieve this?

Hai ,

   Recent item records are not appearing for asset records in customer portal.How to make recent items work sucessfully.I am using standard sidebar component

I have a query 

[Select id,name,(SELECT task.ActivityDate,task.Description,task.Subject FROM test__c.tasks) from test__c]; 

i am able to display test__c and task fields but if test__c do not have any task then visualforce is displaying 

Content cannot be displayed: Subscript is invalid because list is empty.how to handle this?

How can i disable script error notification emails for particular user?

HI all
   Im new to salesforce . i want to write  a trigger  when ever Email/ phone of the account  is updated ,all the contact email should be same. any one help me to solve 

Thank you
Harsha
  • August 18, 2019
  • Like
  • 0
Hi folks,

I've been trying to look for a solution with no luck.
Simply, I'm trying to write an apex trigger to check whether a date/time field is empty while a status field is set to a specific value at the creation or the update of a record...

Any help much appreciated. Thanks
I am trying to create a relationship between Account and Contact, where I am linking account id with contact.
How can I achieve this?
IN order to use go through the "Use SOAP API unit, I need to use an external tool to submit the SOAP request.
This requires the password and token.
I can generate the token, but I have no way of resetting the password.
I used the password that I used to login into the developer.salesforce.com, but that didn't work.

I created a playground to use for this, but I can't reset the password associated to my account.
how to send an email template to multiple Contacts.
The following query works perfectly fine and returns all of these fields but when i checked Account objects fields i could not find CreatedDate field there. What is the reason for that , is this field hidden or something ? 
SELECT  ID,
        Name,
        Industry,
        CreatedById,
        CreatedDate,
        LastMOdifiedByID
FROM    Account
Hi have created trigger to copy billing city into Suburb, it is throwing error 'extraneous input 'City' expecting SEMICOLON'

trigger ContactAddresUpdate on Contact (before insert,before update) {
  if(trigger.isBefore && (trigger.isInsert || trigger.isUpdate)){  
      list<string> lstStr = new list<string>();
      for(Contact objC : trigger.new){
                if(objC.MailingCity != ''){
                   lstStr = objC.Mailing City;
                  objC.Suburb__c = lstStr;
                  }
}
}
}

 
Hi all,

I am working on this since hours trying many code forms, trying with java script, with ajax, etc., without success.

For a special reason I am using two form tags in my Visualforce code.
I have the same case as here described:

https://salesforce.stackexchange.com/questions/8320/how-to-handle-two-form-tags-in-visualforce-page

My javascript code looks like this (this is one of my trials):
 
<apex:form >
             <script type="text/javascript">
                function grabExName(){
                  var ex = document.getElementById('optypage:cform:new_info').value;
                  alert(ex);
                }
             </script>
             <apex:actionFunction name="UpdateRelevantInformation" action="{!UpdateRelevantInformation}" reRender="out" oncomplete="grabExName();">
                <apex:param name="new_info" value="" />
             </apex:actionFunction>
        </apex:form>
This is in the "<body>" part of the code.

My commandbutton looks like this:
 
<apex:commandlink styleclass="btn btn-primary" id="new_info" value="Save new info" action="{!UpdateRelevantInformation}"  />

When I click that button it should let work the form with id "cform", so that when I click on the button, the functionality behind the action "UpdateRelevantInformation" should work.
Am I missing something here? because when I put the button on the second form, "UpdateRelevantInformation" doesn't do anything, but if I put the button in the first form, where the item Relevant Information should be updated, the button works.

I would appreciate your help.
 
I am working on creating a workflow that updates a tickbox field (to TRUE) whenever the Account Owner changes from a specific one to a new one (any owner).

Here's the formula I came up with:

Record Type: Account
Evaluation: Evaluate the rule when a record is created, or edited

Formula evaluates to TRUE:

AND(
ISCHANGED(OwnerId),
PRIORVALUE( OwnerId)= "XXXXXXXXXXXXXXXX"
)

When checking its syntax Salesforce doesn't report any errors. However, when checking the workflow in action (it's been activated) the tick box  doesn't get ticked.

Any ideas as to why the workflow may not be working?
Hi,
Below is the link for web service,
Can anyone please help me how to intergate with VF page.

https://services.boatwizard.com/bridge/events/42b56bbe-d60d-46bd-b4db-3042b9b36428/boats

Thanks,
Prallavi
Hi All,

Could please help me in covering if else conditions in test class for below void method. Thanks in advance.

public void nextDateView() {
        if(defaultDateView.equalsIgnoreCase('Month')){
            startDate = startDate.addMonths(1);
            endDate = endDate.addMonths(1);
        }
        else if(defaultDateView.equalsIgnoreCase('Week')){
            startDate = startDate.addDays(7);
            endDate = endDate.addDays(7);
        }
        else if(defaultDateView.equalsIgnoreCase('Day')){
            startDate = startDate.addDays(1);
            endDate = endDate.addDays(1);
        }

 
What different ways can we hard delete salesforce records.

1. From within Apex (batch) ?
2. Bulk API (Java) ? 
3. Data loader - Hard Delete options ? Tried this, working fine.

Out requirements is to have a batch running every X minutes (inside/outide of SF) which can query records and hard delete them.

-Sid
Hi all,
I want to know what is web to lead? and how can i integrate this with my website.
please tell me what content should be prepair for this requirment.

Thanks in advance...

Hey guys,

 

needed a way to convert from a 15 digit ID to an 18 digit one.

Found the javascript version for just such an action here: http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=13148

 

tried to make my own apex version but the last digit keeps coming out wrong.  Any Ideas?

 

Thank's

 

 

 

String id = '001Q0000002NXad'; //a sample id

 

String suffix = '';

for(integer i=0;i<3;i++){

Integer flags = 0;

for(integer j=0;j<5;j++){
String c = id.substring(i*5+j,i*5+j+1);

if(c >= 'A' && c <='Z'){

flags += 1 << j;
}
}

if (flags <= 25) {

suffix += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.substring(flags,flags+1);

}else suffix += '012345'.substring(flags-26,flags-26+1);
}

System.debug('15-DIGIT:'+Id);
System.debug('18-DIGIT:'+Id + suffix);

 

 

 

Message Edited by astro on 05-01-2009 10:04 PM
Message Edited by astro on 05-01-2009 10:10 PM
  • May 01, 2009
  • Like
  • 0