• Trinay
  • NEWBIE
  • 50 Points
  • Member since 2012

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 34
    Replies

Hi  All,

 

 

          Im Facing an issue while updating the Event records owner change. Below is the error im getting 

"Apex Event trigger cannot handle batch operations on recurring events" .

 

Here is my Query in the trigger,

 

' SELECT Id, OwnerId,Status__c FROM events where  RecurrenceActivityId != null  and IsRecurrence = true '

 

I think there should be mistake in the query.

 

Please help me with the issue

Hi ,

 

Can anybody guide me through the following scenario.

 

I want to insert into an object on the save action of another object. For the same , I have created a trigger ( after insert ).

How can I insert the data that's getting saved to another object ?

 

Hi,

 

 I have some problem in my trigger. when i insert the single record its working perfect. But when i import bulk records it cause the Too many SOQL queries Error.

 

 Please help me:

 

trigger BazookaCode on Account(after insert)
{
string name,fname,lname,substr,anumber,code,code1,code2,code3,code4,code5;
String city='';
String state='';
Integer acount;
Integer acount1;
Set<id> aid = new Set<id>();

for(Account obj : Trigger.new)
{
aid.add(obj.id);
}

List<Account> la = [SELECT id,Name,ShippingCity,ShippingState,AccountNumber FROM Account WHERE id in :aid];
for(Account a : la)
{
if(a.AccountNumber == null)
{
name = a.Name;
fname = a.Name.mid(0,3);
substr = name.substringAfter(' ')+name;
lname = substr.mid(0,3);
city = a.ShippingCity.mid(0,3);
state = a.ShippingState.mid(0,2);

if(name!=substr)
{
code = fname+lname+state;
code1 = code.toUpperCase();
code2 = code1.replaceAll('\\W','');
acount = [SELECT COUNT() FROM Account WHERE AccountNumber LIKE :code2+'%'];
if(acount == 0)
{
a.AccountNumber = code2;
}
else if(acount > 0 && acount < 9)
{
a.AccountNumber = code2 + 0 + acount;
}
else
{
a.AccountNumber = code2 + acount;
}
}
else
{
code3 = fname+city+state;
code4 = code3.toUpperCase();
code5 = code4.replaceAll('\\W','');
acount1 = [SELECT COUNT() FROM Account WHERE AccountNumber LIKE :code5+'%'];
if(acount1 == 0)
{
a.AccountNumber = code5;
}
else if(acount1 > 0 && acount1 < 9)
{
a.AccountNumber = code5 + 0 + acount1;
}
else
{
a.AccountNumber = code5 + acount1;
}
}
update a;
}
}
}

  • November 21, 2012
  • Like
  • 0

Hi,

    

    I know how to show one dashboard snapshot in home page. But  I want to show/display multiple dashboards sanpshot in homepage.

   

    please help me.

  • October 05, 2012
  • Like
  • 0

I want to copy a text field data to another text field . Both the fields are on the same object Task.

 

Is there any way to get  Application_Id__c(in red )???Please help me out.

Code:

 **********************************************

Public string serviceOffering{get;set;}

public Map<id,id> seviceModApp_Map {get;set;}

Quote__c q=[select id,Opportunity__r.Services_Offering__c,Solution_Site_1__c,Solution_Site_2__c,Solution_Site_3__c

                    from Quote__c where id=:id];

        serviceOffering=q.Opportunity__r.Services_Offering__c;        

        List<String> qte = new List<String>();

        qte.add(q.Solution_Site_1__c);

        qte.add(q.Solution_Site_2__c);

        qte.add(q.Solution_Site_3__c);       

        seviceModApp_Map = new Map<id,id>();

        for(Service_Model__c servMod:[select id,name,(select id,Application_ID__c from Service_Model_Applications__r where

            Application_ID__c IN(select Application_Id__c from Site_Application__c where Site_CX__r.Name__c IN:qte))

            from Service_Model__c where Service_ID__r.Name__c=:serviceOffering and Is_Default__c=:True]){

            for(Service_Model_Application__c sma:servMod.Service_Model_Applications__r){

 

                    seviceModApp_Map.put(servMod.id,sma.Application_ID__c);

                    

               

            }

        }

Hi,

 

 I have some problem in my trigger. when i insert the single record its working perfect. But when i import bulk records it cause the Too many SOQL queries Error.

 

 Please help me:

 

trigger BazookaCode on Account(after insert)
{
string name,fname,lname,substr,anumber,code,code1,code2,code3,code4,code5;
String city='';
String state='';
Integer acount;
Integer acount1;
Set<id> aid = new Set<id>();

for(Account obj : Trigger.new)
{
aid.add(obj.id);
}

List<Account> la = [SELECT id,Name,ShippingCity,ShippingState,AccountNumber FROM Account WHERE id in :aid];
for(Account a : la)
{
if(a.AccountNumber == null)
{
name = a.Name;
fname = a.Name.mid(0,3);
substr = name.substringAfter(' ')+name;
lname = substr.mid(0,3);
city = a.ShippingCity.mid(0,3);
state = a.ShippingState.mid(0,2);

if(name!=substr)
{
code = fname+lname+state;
code1 = code.toUpperCase();
code2 = code1.replaceAll('\\W','');
acount = [SELECT COUNT() FROM Account WHERE AccountNumber LIKE :code2+'%'];
if(acount == 0)
{
a.AccountNumber = code2;
}
else if(acount > 0 && acount < 9)
{
a.AccountNumber = code2 + 0 + acount;
}
else
{
a.AccountNumber = code2 + acount;
}
}
else
{
code3 = fname+city+state;
code4 = code3.toUpperCase();
code5 = code4.replaceAll('\\W','');
acount1 = [SELECT COUNT() FROM Account WHERE AccountNumber LIKE :code5+'%'];
if(acount1 == 0)
{
a.AccountNumber = code5;
}
else if(acount1 > 0 && acount1 < 9)
{
a.AccountNumber = code5 + 0 + acount1;
}
else
{
a.AccountNumber = code5 + acount1;
}
}
update a;
}
}
}

  • November 21, 2012
  • Like
  • 0

Hi,

how to display list of records by using below soql query ,.....

 

it is write code in apex class and the results in system .debug....

 

please help me frnds..........

 

 

using this soql query...

 

Select Id, Name, (Select Id, Name From Contacts) From Account

  • October 12, 2012
  • Like
  • 0

Hi  All,

 

 

          Im Facing an issue while updating the Event records owner change. Below is the error im getting 

"Apex Event trigger cannot handle batch operations on recurring events" .

 

Here is my Query in the trigger,

 

' SELECT Id, OwnerId,Status__c FROM events where  RecurrenceActivityId != null  and IsRecurrence = true '

 

I think there should be mistake in the query.

 

Please help me with the issue

Hi,

 I have object called Sales and it has field Quote__c which is lookup to Quote object and in Quote object we have field called

Opportunity__c which is lookup to Opp object now on Sales object page if i select Quote__c then the Opp field on this sales object should pull up the Opp from Quote , can anyone help on this ?

 

trigger Opp on Sales__c (before Insert, before Update) {

    for(Sales__c s : Trigger.New)
    {
      if(s.Quote__c != null)
        {
            Quote__c q = new Quote__c();
            s.Opp__c =  q.Opportunity__c;
        }
       
    }

}

The following is the Confirmation page in my app. 

<apex:page standardController="Product__c" extensions="myBookedController" tabStyle="Product__c" sidebar="false" showHeader="false">
<body background="{!$Resource.bg}">
<center><u><font face = "comic sans ms" color="blue" size="6"><b>Welcome to Online Shopping</b></font></u></center><br></br><br></br>


<apex:form >
<apex:pageBlock >
<p align="center">
<br></br><br></br>

</p>
<p align="center">

<apex:image url="{!$Resource.s3}" width="100" height="100" rendered="{!Product__c.Model__c =='Galaxy S3'}" />
<apex:image url="{!URLFOR($Resource.myshopping, 'my_img/m2.jpg')}" width="50" height="50" rendered="{!Product__c.Model__c =='Xperia-U'}" />
<apex:image url="{!URLFOR($Resource.myshopping, 'my_img/m3.jpg')}" width="50" height="50" rendered="{!Product__c.Model__c =='Defy'}" />

<apex:image url="{!URLFOR($Resource.myshopping, 'my_img/t1.jpg')}" width="150" height="150" rendered="{!Product__c.Model__c =='LED'}" />
<apex:image url="{!URLFOR($Resource.myshopping, 'my_img/t2.jpg')}" width="150" height="150" rendered="{!Product__c.Model__c =='LCD'}" />
<apex:image url="{!URLFOR($Resource.myshopping, 'my_img/t3.jpg')}" width="150" height="150" rendered="{!Product__c.Model__c =='HD'}" />

<apex:image url="{!URLFOR($Resource.myshopping, 'my_img/r1.jpg')}" width="150" height="150" rendered="{!Product__c.Model__c =='Cool'}" />
<apex:image url="{!URLFOR($Resource.myshopping, 'my_img/r2.jpg')}" width="150" height="150" rendered="{!Product__c.Model__c =='Eon'}" />
<apex:image url="{!URLFOR($Resource.myshopping, 'my_img/r3.jpg')}" width="150" height="150" rendered="{!Product__c.Model__c =='Master'}" />


<apex:image url="{!URLFOR($Resource.myshopping, 'my_img/c2.jpg')}" width="150" height="150" rendered="{!Product__c.Model__c =='Powershot'}" />
<apex:image url="{!URLFOR($Resource.myshopping, 'my_img/c1.jpg')}" width="150" height="150" rendered="{!Product__c.Model__c =='SLR'}" />
<apex:image url="{!URLFOR($Resource.myshopping, 'my_img/c3.jpg')}" width="50" height="50" rendered="{!Product__c.Model__c =='Lumix'}" />


</p>
<p align="center">
<b>You are going to view the details of Product No:</b> <apex:outputField value="{!product.Name}"/>
</p>

<br></br>
<p align="center">

<br/><b>Company:</b> <apex:outputField value="{!product.Company__c}"/>
<br/><b>Model:</b> <apex:outputField value="{!product.Model__c}"/>
<br/><b>Color:</b> <apex:outputField value="{!product.Color__c}"/>
<br/><b>Price:</b> <apex:outputField value="{!product.Price__c}"/><br></br><br></br>

<apex:commandButton action="{!saveandredirect}" value="Confirm" style="color:white;background:red;" />


</p>

</apex:pageBlock>
</apex:form>
</body>
</apex:page>

 

<-----------------------------------Controller---------------------------------------->

public with sharing class myBookedController {
Product__c prod;


public myBookedController(ApexPages.StandardController controller) {
String id = ((Product__c)controller.getRecord()).id;
this.prod = [Select p.Name, p.Company__c, p.Model__c,p.Color__c,p.Price__c from Product__c p where p.id=:id];
}

Booking__c booking = new Booking__c();

public Product__c getProduct() {
return prod;
}

 

Public Pagereference saveandredirect(){

booking.Company__c = prod.Company__c;
booking.Model__c = prod.Model__c;
booking.Color__c = prod.Color__c;
booking.Price__c = prod.Price__c;

upsert booking;


Pagereference p = new Pagereference('/apex/loginpage');
p.setredirect(true);

return p;

}
}

I wish to fetch these details onto another page named Final which is the last page in my app. But whenever i'm trying to fetch id of the product for which booking is done, it throws some error. In between the confirmation page and the final page i've a loginpage.

I am very new to Apex development and this is my very first trigger. I am trying to update a custom field 'No_on_Call__c' on Tasks which counts the number of people that are on the call since we activated the Shared Activites feature recently.

When saving a test task the trigger gives me a SELF REFERENCE error and says it cannot recursively update itself. It makes sense but i just cannot figure out how to fix this and it is frustrating me no end.

 

Here is the code:

 

trigger Numberofcalls on Task (before insert,before update) {

Integer i=0;

// Get TaskID

String TskID= Trigger.new[i].Id;

list<TaskRelation> Tsr= [SELECT RelationId  FROM TaskRelation WHERE TaskId = :TskID];

list<Task> Tsk= [Select No_on_Call__c FROM Task WHERE Id =: TskId];

for (Task o : Tsk) {
                Integer count = Tsk.size();

                if (o.No_on_Call__c != count) {
                    o.No_on_Call__c = count;
                   
                }
         Update o;       
           
            }
            
}

i want to pass a list of task records 

say 

List<Task> Tasklist 

to the batch class for insertion.

How to call Batch class for this list of tasks.

hi guys i have woring on METADATA Api 

 

and i have successfully create soap envelope to add new picklist value in picklist field

via

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:met="http://soap.sforce.com/2006/04/metadata">
   <soapenv:Header>
      <met:CallOptions>
         <met:client>---</met:client>
      </met:CallOptions>
      <met:SessionHeader>
         <met:sessionId>---</met:sessionId>
      </met:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <update xmlns="http://soap.sforce.com/2006/04/metadata">
     <!--Zero or more repetitions:-->
      <UpdateMetadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="customfield">
		    <currentName>lead.number__c</currentName>
		                
		      <metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CustomField">
		      <!--Optional:-->
		       <fullName>lead.number__c</fullName>
		       <label>number</label>
		    		<picklist>
		              <picklistValues>
		         			<fullName>new</fullName>
		              </picklistValues>
		         		 <sorted>false</sorted>
		  		</picklist>
		         <type>Picklist</type>
		    </metadata>
         </UpdateMetadata>
       </update>
   </soapenv:Body>
</soapenv:Envelope>

 Now issues I am facing , is

Is there any way to update / edit any particular picklist value ???

 

e.g , Object : Lead , field : number__c, type : picklist , picklist values : new , old 

 

any way i can edit "new " to "new_value" via meta data API .

 

Thanks to soap and metadata api developers in advance 

 

Hi,
 
I displayed sobject records with pagination Next, Previous links with page limit 20 records.
In my account have 200 records. My requirement is 

Previous 1 2 3 4 5 Next
 
First time Page no1 is active and clicking on next button link will go next numbers
like google search links Can you please any body help me. Thank you

 

Hey guys I need ur hel. I m unable to find a logic for code my situation are I have two fields  and wen theTwo particular fields are changed or updates I should have set a trigger that automatically fire a email to the user . Please any one can help me 

{!REQUIRESCRIPT("/soap/ajax/24.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")}
{!REQUIRESCRIPT("{!URLFOR($Resource.jquery)}")}

 

 

Where can I find "/soap/ajax/24.0/connection.js", "/soap/ajax/20.0/apex.js" these files in salesforce?

What is the purpose of using these files?

I have written the following Validation rule; adding several different countries.  The request is if the Account Country is one of these Countries; then the Agent Sales Rep is to be required/mandatory.

 

The rule checks out ok but is not firing.  Any suggestions?

 

AND( $RecordType.Name = "BBA_Strategic_Account_Opportunity",  $RecordType.Name  = "BBA_Service_Programs", OR( BEGINS("Bangladesh",  Account_Country__c ), BEGINS("Belize",  Account_Country__c ), BEGINS("Bermuda",  Account_Country__c ), BEGINS("Bolivia",  Account_Country__c ), BEGINS("Chile",  Account_Country__c ), BEGINS("China",  Account_Country__c ), BEGINS("Costa Rica",  Account_Country__c ), BEGINS("Ecuador",  Account_Country__c ), BEGINS("El Salvador",  Account_Country__c ), BEGINS("French Guiana",  Account_Country__c ), BEGINS("Guatemala",  Account_Country__c ) , BEGINS("Guyana",  Account_Country__c ), BEGINS("Honduras",  Account_Country__c ) , BEGINS("India",  Account_Country__c ) , BEGINS("Mauritus", Account_Country__c ), BEGINS("Nepal",  Account_Country__c ), BEGINS("Nicaragua",  Account_Country__c ), BEGINS("Panama",  Account_Country__c ), BEGINS("Paraguay",  Account_Country__c ), BEGINS("Peru",  Account_Country__c ), BEGINS("Portugal",  Account_Country__c ), BEGINS("Spain",  Account_Country__c ), BEGINS("Sri Lanka",  Account_Country__c ), BEGINS("Suriname",  Account_Country__c ), BEGINS("Uruguay",  Account_Country__c ), ISBLANK( TEXT( Agent_Sales_Rep__c ))))

  • October 03, 2012
  • Like
  • 0

Hi,

 

i created some Triggers/Classe and i want to launch them by clicking on a button so far it's working by using a VF page who is calling my classes. The issue s that i want to know how to forbib my classes to be launched in some case ( for the example a boolean who is false).

 

Someone told me about using javascript but i'm pretty bad and it's kind a mess for me ...

 

Does anyone can help me??( if you can give me a strong exemple it would be awesome

 

Thanks

I have two field 

 

Quanity( Field type= Number)

Price(Field Type= Currency)

 

how can i calculateTotal(Field type=Currency)

 

When i try price__c.qua__c. It throws me "Error: Field price__c may not be used in this type of formula"

 

Can you please help me without changing field type.

 

Thanks,

Karthik

Hi All,

 

I am working on salesforce to java integration through webservices

 

How to write a select query using two tables like QuoteLineItem and PricebookEntry and compare id's  and get the product2id . this query how to write ?

 

i write a query like this 

 

QueryResult q = binding.query("select id,(select id,product2id from PricebookEntry)from QuoteLineItem");

 

i am getting errors

 

AxisFault
faultCode: {urn:fault.enterprise.soap.sforce.com}INVALID_TYPE
faultSubcode:
faultString: INVALID_TYPE:
id,(select id,product2id from PricebookEntry)from QuoteLineItem
^
ERROR at Row:1:Column:38
Didn't understand relationship 'PricebookEntry' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
faultActor:
faultNode:
faultDetail:
{urn:fault.enterprise.soap.sforce.com}InvalidSObjectFault:<ns1:exceptionCode>INVALID_TYPE</ns1:exceptionCode><ns1:exceptionMessage>
id,(select id,product2id from PricebookEntry)from QuoteLineItem
^

 

plz help..

 

 

  • September 21, 2012
  • Like
  • 0

We have Marketo installed with Salesforce, and it has it's own tab with a visualforce page.


I created a custom HTML component for adding this VF page to the home page and my code is the following:

<iframe src="/apex/mkto_si__Dashboard?isdtp=lt" frameborder="0" height="900" width="1280"></iframe>

It loads, however, the background to the table rows changed from white to purple, and on hover, the table's rows changed from a light blue to white.

Is there something I need to define in the HTML component to make sure it appears in the VF's page's defined colors?

Here is a screen shot of how it appers in it's normal VF page (The second image, or the one at the bottom), and how it appears in the custom HTML component (the first image, or the one at the top).

 

  • September 14, 2012
  • Like
  • 0