• kishore64
  • NEWBIE
  • 10 Points
  • Member since 2014
  • Software developer

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 16
    Replies
Hi Folks,

I had implemented a Force.com site and the same site i am using in session setting return URL.
When ever the user is logging out am redirecting to this site URL,at this time i want to know the current user eamil id(by using Userinfo.getUserId() am getting the user email) but here the problem is, when am querying the current user ID while logging out am getting my user email id only for all users because site had created with my user id.So, how can we get the current user email ID while logging out.

Please help me out on this.....
Hi folks,

I have a requirement like,I have a command button and if any one is clicking on this,we are redirceting to another page but when ever the user is closing the same tab or browser,we are throwing an error message through JavaScript(window.onbeforeunload event) but here the problem is,if am clicking on the command button  this script is executing i.e, this error message is coming and i want to stop script execution on clicking on command button.

Please help me out!!!!!
Hi everybody,

      Actually i have checkbox field in my child record Here my requirement is the recent record should be active. For Example:I have 2 records in parent object under that one record have 3 childs and  the 3 child record should be active for that i wrote a trigger that is working fine but my problem is it is taking the overall child records which is recent record then that is activating the checkbox but i need 0ne parent record under 3 childs are there i want 3 rd record should be activate at the same time the second parent record have 3 childs here also the 3rd record should be activte. Totally i need 2 activate child records for that object.


Here i am implemented the trigger i know i am not writing any query on parent object but how to write i don't know that's reason i am posting here


trigger  ActivateSpecificationSheet on Specification_Sheet__c(before insert) {
    if(trigger.isInsert){
    for(Specification_Sheet__c ssh : Trigger.New){
   
        ssh.Is_Active__c = true;
     }
   
     List<Specification_Sheet__c > updssh = New List<Specification_Sheet__c >();
  
   
     List<Specification_Sheet__c > sshlst = [select id,name,Is_Active__c,Sales_Order_LineItem__c from Specification_Sheet__c where Is_Active__c = true ];

        for(Specification_Sheet__c ssh1: sshlst){
      
        ssh1.Is_Active__c=false;
        updssh.add(ssh1);
        }
        update updssh;
      
}

}

Can any one suggest me please help me out......
Hi everybody,

      Actually i have checkbox field in my child record Here my requirement is the recent record should be active. For Example:I have 2 records in parent object under that one record have 3 childs and  the 3 child record should be active for that i wrote a trigger that is working fine but my problem is it is taking the overall child records which is recent record then that is activating the checkbox but i need 0ne parent record under 3 childs are there i want 3 rd record should be activate at the same time the second parent record have 3 childs here also the 3rd record should be activte. Totally i need 2 activate child records for that object.


Here i am implemented the trigger i know i am not writing any query on parent object but how to write i don't know that's reason i am posting here


trigger  ActivateSpecificationSheet on Specification_Sheet__c(before insert) {
    if(trigger.isInsert){
    for(Specification_Sheet__c ssh : Trigger.New){
    
        ssh.Is_Active__c = true;
     }
    
     List<Specification_Sheet__c > updssh = New List<Specification_Sheet__c >();
   
    
     List<Specification_Sheet__c > sshlst = [select id,name,Is_Active__c,Sales_Order_LineItem__c from Specification_Sheet__c where Is_Active__c = true ];
 
        for(Specification_Sheet__c ssh1: sshlst){
       
        ssh1.Is_Active__c=false;
        updssh.add(ssh1);
        }
        update updssh;
       
}

}

Can any one suggest me please help me out......

Hi every one,
       I have a problem regarding Email to Lead i.e, when ever the customer sending an email to salesforce then the lead is automatically  created in our organization. But the total lead details goes to Description field but i don't want like that .My requirement is, In the mail customer sends like this
  Name : kishore
  Company : XXXXXXX
Industry : Banking

I want this details directly in that partucular fields. So how can i acheive this one Please help me out........

Advance Thank you.
Hi every one,
       I have a problem regarding Email to Lead i.e, when ever the customer sending an email to salesforce then the lead is automatically  created in our organization. But the total lead details goes to Description field but i don't want like that .My requirement is, In the mail customer sends like this
  Name : kishore
  Company : XXXXXXX
Industry : Banking

I want this details directly in that partucular fields. So how can i acheive this one Please help me out........

Advance Thank you.
Hi every one,
       I have a problem regarding Email to Lead i.e, when ever the customer sending an email to salesforce then the lead is automatically  created in our organization. But the total lead details goes to Description field but i don't want like that .My requirement is, In the mail customer sends like this
  Name : kishore
  Company : XXXXXXX
 Industry : Banking

I want this details directly in that partucular fields. So how can i acheive this one Please help me out........

Advance Thank you.
Hi all,

Here i am writng the test class like,


@isTest(seeAllData=true)
public class testSyncQuotaLineItemsCls{
public static testMethod void testSyncQuotaLineItemsCls(){

             Contact con = New Contact();
             con.LastName='test';
             insert con;

            Opportunity opp = new Opportunity();
            opp.Name='test';
            opp.CloseDate=Date.Today();
            opp.StageName='Prospecting';
            opp.Contact_del__c=con.id;
            insert opp;
           
             Quote qta = new Quote();
             qta.Name='test';
             qta.opportunityid=opp.id;
             qta.Address_Information__c='Bangalore';
             insert qta;
           
             Sales_Order_LineItem__c soli = New Sales_Order_LineItem__c();
             soli.Name='test';
             insert soli;
           
             Product2 pr = New Product2();
             pr.Name='test';
             pr.IsActive=true;
             insert pr;
           
             PriceBook2 pb2 = New PriceBook2();
             pb2.Name = 'test';
             pb2.IsActive=true;
            // pb2.IsStandard=true;
             insert pb2;
            Pricebook2 p =[Select p.Id, p.Name from Pricebook2 p where isActive = true AND isStandard=true Limit 1];
         
      
             PricebookEntry pb = New PricebookEntry();
                pb.Product2Id = pr.Id;
                pb.PriceBook2Id = pb2.id;
                pb.UseStandardPrice = true;
                pb.UnitPrice=35;
                pb.isActive=true;
                insert pb;                      
   PricebookEntry pb1 = [select id,name,usestandardprice from PricebookEntry where usestandardprice=true];
 

             QuoteLineItem qli = New QuoteLineItem();
             qli.Product2Id=pr.id;
             qli.UnitPrice=12;
             qli.Quantity=5;
             qli.QuoteId=qta.id;
             qli.UnitPrice=35;
            // qli.ListPrice=410;
             //qli.Subtotal=123;
             //qli.TotalPrice=410;
             qli.PricebookEntryId=pb.id;
             insert qli;
       
           string qtaid = qta.id;
   
     SyncQuotaLineItemsCls sqli = New SyncQuotaLineItemsCls();
        SyncQuotaLineItemsCls.syncQLItoSLI(qtaid);

     }
}

Error is:  System.DmlException: Insert failed. First exception on row 0; first error: STANDARD_PRICE_NOT_DEFINED, No standard price defined for this product: []

Here where i did mistake i don't know . please help me out .

Advance Thank you.
Hi all,

Here i am writng the test class like,


@isTest(seeAllData=true)
public class testSyncQuotaLineItemsCls{
public static testMethod void testSyncQuotaLineItemsCls(){

             Contact con = New Contact();
             con.LastName='test';
             insert con;

            Opportunity opp = new Opportunity();
            opp.Name='test';
            opp.CloseDate=Date.Today();
            opp.StageName='Prospecting';
            opp.Contact_del__c=con.id;
            insert opp;
           
             Quote qta = new Quote();
             qta.Name='test';
             qta.opportunityid=opp.id;
             qta.Address_Information__c='Bangalore';
             insert qta;
           
             Sales_Order_LineItem__c soli = New Sales_Order_LineItem__c();
             soli.Name='test';
             insert soli;
           
             Product2 pr = New Product2();
             pr.Name='test';
             pr.IsActive=true;
             insert pr;
           
             PriceBook2 pb2 = New PriceBook2();
             pb2.Name = 'test';
             pb2.IsActive=true;
            // pb2.IsStandard=true;
             insert pb2;
            Pricebook2 p =[Select p.Id, p.Name from Pricebook2 p where isActive = true AND isStandard=true Limit 1];
         
      
             PricebookEntry pb = New PricebookEntry();
                pb.Product2Id = pr.Id;
                pb.PriceBook2Id = pb2.id;
                pb.UseStandardPrice = true;
                pb.UnitPrice=35;
                pb.isActive=true;
                insert pb;                      
   PricebookEntry pb1 = [select id,name,usestandardprice from PricebookEntry where usestandardprice=true];
 

             QuoteLineItem qli = New QuoteLineItem();
             qli.Product2Id=pr.id;
             qli.UnitPrice=12;
             qli.Quantity=5;
             qli.QuoteId=qta.id;
             qli.UnitPrice=35;
            // qli.ListPrice=410;
             //qli.Subtotal=123;
             //qli.TotalPrice=410;
             qli.PricebookEntryId=pb.id;
             insert qli;
       
           string qtaid = qta.id;
   
     SyncQuotaLineItemsCls sqli = New SyncQuotaLineItemsCls();
        SyncQuotaLineItemsCls.syncQLItoSLI(qtaid);

     }
}

Error is:  System.DmlException: Insert failed. First exception on row 0; first error: STANDARD_PRICE_NOT_DEFINED, No standard price defined for this product: []

Here where i did mistake i don't know . please help me out .

Advance Thank you.
I have a custom object under opportunity. This opportunity have a quote . Under quote , quotelineitem is there when ever i am clicking StartSync(It's in Quote object) what ever i am updating in quoteline item it should automatically update the Custom object under that opportunity only .       Is it possible to update ?



Thanks in advance 
Hi buddies,

I was not able to display records in horizontally.
Ex : In a table am retrieving phone,email from contact. Now i want to show phone,Email in horizontally.

Normally we can show them in columns, but my client needs thus to be display in horizontally.

Phone   98451212312      9876789989         9888999999
Email    test@test.com      test1@tes.com     test2@test.com

Waiting for your respnse buddies.
Hi buddies,

I was not able to display records in horizontally.
Ex : In a table am retrieving phone,email from contact. Now i want to show phone,Email in horizontally.

Normally we can show them in columns, but my client needs thus to be display in horizontally.

Phone   98451212312      9876789989         9888999999
Email    test@test.com      test1@tes.com     test2@test.com

Waiting for your respnse buddies.
I have been trying to hide the edit button from all of the tabs of my salesforce app. Is there a way to do it?? 
Hi folks,

I have a requirement like,I have a command button and if any one is clicking on this,we are redirceting to another page but when ever the user is closing the same tab or browser,we are throwing an error message through JavaScript(window.onbeforeunload event) but here the problem is,if am clicking on the command button  this script is executing i.e, this error message is coming and i want to stop script execution on clicking on command button.

Please help me out!!!!!
Hi every one,
       I have a problem regarding Email to Lead i.e, when ever the customer sending an email to salesforce then the lead is automatically  created in our organization. But the total lead details goes to Description field but i don't want like that .My requirement is, In the mail customer sends like this
  Name : kishore
  Company : XXXXXXX
Industry : Banking

I want this details directly in that partucular fields. So how can i acheive this one Please help me out........

Advance Thank you.
Hi all,

Here i am writng the test class like,


@isTest(seeAllData=true)
public class testSyncQuotaLineItemsCls{
public static testMethod void testSyncQuotaLineItemsCls(){

             Contact con = New Contact();
             con.LastName='test';
             insert con;

            Opportunity opp = new Opportunity();
            opp.Name='test';
            opp.CloseDate=Date.Today();
            opp.StageName='Prospecting';
            opp.Contact_del__c=con.id;
            insert opp;
           
             Quote qta = new Quote();
             qta.Name='test';
             qta.opportunityid=opp.id;
             qta.Address_Information__c='Bangalore';
             insert qta;
           
             Sales_Order_LineItem__c soli = New Sales_Order_LineItem__c();
             soli.Name='test';
             insert soli;
           
             Product2 pr = New Product2();
             pr.Name='test';
             pr.IsActive=true;
             insert pr;
           
             PriceBook2 pb2 = New PriceBook2();
             pb2.Name = 'test';
             pb2.IsActive=true;
            // pb2.IsStandard=true;
             insert pb2;
            Pricebook2 p =[Select p.Id, p.Name from Pricebook2 p where isActive = true AND isStandard=true Limit 1];
         
      
             PricebookEntry pb = New PricebookEntry();
                pb.Product2Id = pr.Id;
                pb.PriceBook2Id = pb2.id;
                pb.UseStandardPrice = true;
                pb.UnitPrice=35;
                pb.isActive=true;
                insert pb;                      
   PricebookEntry pb1 = [select id,name,usestandardprice from PricebookEntry where usestandardprice=true];
 

             QuoteLineItem qli = New QuoteLineItem();
             qli.Product2Id=pr.id;
             qli.UnitPrice=12;
             qli.Quantity=5;
             qli.QuoteId=qta.id;
             qli.UnitPrice=35;
            // qli.ListPrice=410;
             //qli.Subtotal=123;
             //qli.TotalPrice=410;
             qli.PricebookEntryId=pb.id;
             insert qli;
       
           string qtaid = qta.id;
   
     SyncQuotaLineItemsCls sqli = New SyncQuotaLineItemsCls();
        SyncQuotaLineItemsCls.syncQLItoSLI(qtaid);

     }
}

Error is:  System.DmlException: Insert failed. First exception on row 0; first error: STANDARD_PRICE_NOT_DEFINED, No standard price defined for this product: []

Here where i did mistake i don't know . please help me out .

Advance Thank you.
Hi all,

Here i am writng the test class like,


@isTest(seeAllData=true)
public class testSyncQuotaLineItemsCls{
public static testMethod void testSyncQuotaLineItemsCls(){

             Contact con = New Contact();
             con.LastName='test';
             insert con;

            Opportunity opp = new Opportunity();
            opp.Name='test';
            opp.CloseDate=Date.Today();
            opp.StageName='Prospecting';
            opp.Contact_del__c=con.id;
            insert opp;
           
             Quote qta = new Quote();
             qta.Name='test';
             qta.opportunityid=opp.id;
             qta.Address_Information__c='Bangalore';
             insert qta;
           
             Sales_Order_LineItem__c soli = New Sales_Order_LineItem__c();
             soli.Name='test';
             insert soli;
           
             Product2 pr = New Product2();
             pr.Name='test';
             pr.IsActive=true;
             insert pr;
           
             PriceBook2 pb2 = New PriceBook2();
             pb2.Name = 'test';
             pb2.IsActive=true;
            // pb2.IsStandard=true;
             insert pb2;
            Pricebook2 p =[Select p.Id, p.Name from Pricebook2 p where isActive = true AND isStandard=true Limit 1];
         
      
             PricebookEntry pb = New PricebookEntry();
                pb.Product2Id = pr.Id;
                pb.PriceBook2Id = pb2.id;
                pb.UseStandardPrice = true;
                pb.UnitPrice=35;
                pb.isActive=true;
                insert pb;                      
   PricebookEntry pb1 = [select id,name,usestandardprice from PricebookEntry where usestandardprice=true];
 

             QuoteLineItem qli = New QuoteLineItem();
             qli.Product2Id=pr.id;
             qli.UnitPrice=12;
             qli.Quantity=5;
             qli.QuoteId=qta.id;
             qli.UnitPrice=35;
            // qli.ListPrice=410;
             //qli.Subtotal=123;
             //qli.TotalPrice=410;
             qli.PricebookEntryId=pb.id;
             insert qli;
       
           string qtaid = qta.id;
   
     SyncQuotaLineItemsCls sqli = New SyncQuotaLineItemsCls();
        SyncQuotaLineItemsCls.syncQLItoSLI(qtaid);

     }
}

Error is:  System.DmlException: Insert failed. First exception on row 0; first error: STANDARD_PRICE_NOT_DEFINED, No standard price defined for this product: []

Here where i did mistake i don't know . please help me out .

Advance Thank you.
Hi buddies,

I was not able to display records in horizontally.
Ex : In a table am retrieving phone,email from contact. Now i want to show phone,Email in horizontally.

Normally we can show them in columns, but my client needs thus to be display in horizontally.

Phone   98451212312      9876789989         9888999999
Email    test@test.com      test1@tes.com     test2@test.com

Waiting for your respnse buddies.
Hi, how can i default a dependent picklist value if there is only one value?

for example, i have controling picklist value of A,B,C and dependent picklist value of 1,2,3,6,7,8

A - 1,2,3
B - 6
C - 7,8

so when i select B my dependent picklist will automatically show 6 instead of None and need to choose again since there is only onle value there.

hi,

I'm trying to create a test class for a trigger:

 

trigger deleteTask on OpportunityLineItem (before delete) {

List<OpportunityLineItem> OppLIs = Trigger.old;
List<Task> tasks = new List<Task>();

for (OpportunityLineItem OppLI : OppLIs) {

Opportunity Opp = [ Select OwnerId from Opportunity where id=:OppLI.OpportunityId limit 1 ];
User usuario = [ Select Sociedad__c from User where id=:Opp.OwnerId ];

//el usuario debe pertenecer a argentina = usuario.Sociedad__c == 1000
if ( usuario.Sociedad__c == '1000' ) {
tasks = [ Select Id from Task where whatID=:OppLI.OpportunityId and Subject='Recordatorio: Vencimiento de producto'];
}
}

delete tasks;

}

 

My test class is:

 

@isTest
private class deleteTaskTest {

static testMethod void myUnitTest() {

//Create a custom pricebook
Pricebook2 pb = new Pricebook2(Name='Custom Pricebok',IsActive=true);
insert pb;

// Create a new product
Product2 prod = new Product2(IsActive=true, Name='Product');
insert prod;

// Create a pricebook entry for custom pricebook
PricebookEntry pbe2 = new PricebookEntry(Pricebook2Id=pb.Id, Product2Id=prod.Id,
IsActive=true, CurrencyIsoCode='ARS', UnitPrice=100,

  UseStandardPrice=false);

insert pbe2;

test.startTest();

delete prod;

test.stopTest();

}
}

 


When I run this test class, I get this error message:

 

 Insert failed. First exception on row 0; first error: STANDARD_PRICE_NOT_DEFINED, No standard price defined for this product: []

 

In the line: insert pbe2;

 

 Can someone understand why this is happening? Thanks!

  • December 07, 2009
  • Like
  • 0