• Abhijeet Purohit01
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 49
    Questions
  • 70
    Replies

There are 3 objects BOQ(BOM__c), BOQ Item(BOM_Item__c), Quote Line Item.

There is a Master_Detail relationship between BOQ and BOQ Item. BOQ being Master.

There is a LookUp relationship between BOQ and Quote Line Item.

There are two fields, among other fields, in the BOQ Item: Record_Type__c is a picklist field with the values "Bought-Out Item" and "Processed Item"; and BOQ_Quantity__c which is a number field.

There is a picklist field called Rate_Basis__c in Quote Line Item with the values "Per Kg" and "Per Unit".

 

Requirement: I was asked to create a workflow on BOQ Item object to update the BOQ_Quantity__c field by some value iff

Record_Type__c = "Bought-Out Item" and Rate_Basis__c = "Per Kg"

and iff

Record_Type__c = "Bought-Out Item" and Rate_Basis__c = "Per Unit"

then BOQ_Quantity__c = some other value.

 

I created 2 WorkFlows as below:

 

Workflow 1: Rule Name   BOQ Quantity: PER KG

 

              Rule Criteria   AND( ISPICKVAL( Record_Type__c , "Bought-Out Item"), 
ISPICKVAL( BOM__r.Quote_Lookup__r.Rate_Basis__c, "Per Kg") )

 

              Evaluation Criteria  Evaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria

 

               Immediate Workflow Actions

               Field Update
                            BOQ_Quantity__c = Some value1.

 

Workflow 2: Rule Name   BOQ Quantity: PER UNIT

 

              Rule Criteria   AND( ISPICKVAL( Record_Type__c , "Bought-Out Item"), 
ISPICKVAL( BOM__r.Quote_Lookup__r.Rate_Basis__c, "Per Unit") )

              Evaluation Criteria  Evaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria

 

               Immediate Workflow Actions

               Field Update
                            BOQ_Quantity__c = Some value2.

Its not working. The Workflows are not triggering any values. What to do?

There are 3 objects BOQ(BOM__c), BOQ Item(BOM_Item__c), Quote Line Item.

There is a Master_Detail relationship between BOQ and BOQ Item. BOQ being Master.

There is a LookUp relationship between BOQ and Quote Line Item.

There are two fields, among other fields, in the BOQ Item: Record_Type__c is a picklist field with the values "Bought-Out Item" and "Processed Item"; and BOQ_Quantity__c which is a number field.

There is a picklist field called Rate_Basis__c in Quote Line Item with the values "Per Kg" and "Per Unit".

 

Requirement: I was asked to create a workflow on BOQ Item object to update the BOQ_Quantity__c field by some value iff

Record_Type__c = "Bought-Out Item" and Rate_Basis__c = "Per Kg"

and iff

Record_Type__c = "Bought-Out Item" and Rate_Basis__c = "Per Unit"

then BOQ_Quantity__c = some other value.

 

I created 2 WorkFlows as below:

 

Workflow 1: Rule Name   BOQ Quantity: PER KG

 

              Rule Criteria   AND( ISPICKVAL( Record_Type__c , "Bought-Out Item"), 
ISPICKVAL( BOM__r.Quote_Lookup__r.Rate_Basis__c, "Per Kg") )

 

              Evaluation Criteria  Evaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria

 

               Immediate Workflow Actions

               Field Update
                            BOQ_Quantity__c = Some value1.

 

Workflow 2: Rule Name   BOQ Quantity: PER UNIT

 

              Rule Criteria   AND( ISPICKVAL( Record_Type__c , "Bought-Out Item"), 
ISPICKVAL( BOM__r.Quote_Lookup__r.Rate_Basis__c, "Per Unit") )

              Evaluation Criteria  Evaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria

 

               Immediate Workflow Actions

               Field Update
                            BOQ_Quantity__c = Some value2.

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

Its not working. The Workflows are not triggering any values. What to do?

 

There are 3 objects:

 

1. Quote: Standard Object

2. Quote Line Item: Standard object

3. BOQ Item: Custom object.

 

 

i>  BOQ Item is in a Master Detail relationship with BOQ. BOQ Item is detail object in the relationship.

ii> BOQ is in a look up relationship with Quote Line Item.

iii> There is a picklist field in the Quote Line Item called Rate Basis.

iv> I have created a formula field in the BOQ Item with the following formula:

Text(BOQ__c.Quote_Lookup__r.Rate_Basis__c)

 

There are no errors in the formula but at the same time no value is getting displayed.

 

 

What could be the problem?

Kindly help

 

Abhijeet

There are 3 objects:

 

1. Quote: Standard Object

2. Quote Line Item: Standard object

3. BOQ Item: Custom object.

 

 

i>  BOQ Item is in a Master Detail relationship with BOQ. BOQ Item is detail object in the relationship.

ii> BOQ is in a look up relationship with Quote Line Item.

iii> There is a picklist field in the Quote Line Item called Rate Basis.

iv> I have created a formula field in the BOQ Item with the following formula:

Text(BOQ__c.Quote_Lookup__r.Rate_Basis__c)

 

There are no errors in the formula but at the same time no value is getting displayed.

 

 

What could be the problem?

Kindly help

 

Abhijeet

Please can anyone tell me what mistake am doing here? It is not querying any values from the database. It is working without errors but daata is not querying. Kindly help pls.

 

global class OrderStatusComponentClass{

      

    Id accId;

    global String name {get;set;}

   

    global List<Sales_Order__c> pendingorder { get;set;}

    global List<Sales_Order__c> pending1 {get;set;}

    global List<Sales_Order__c> recentDespatch { get; set;}

    global List<Sales_Order__c> despatch1 { get; set;}

   

    private final Account account;

    public OrderStatusComponentClass(){

      try{

        account = [select Name,id, (SELECT Contact.Name, Contact.Email FROM Account.Contacts where Contact.Email != null  AND Credit_Report__c LIKE 'Yes' )  from Account where id = :ApexPages.currentPage().getParameters().get('id')];

        system.debug('try block:'+account);

      }

      catch(Exception e){

        System.debug('error sending mail'+e);

      }

    }

   

   

     // querying data for component

   public pageReference querySO1(){

   

     System.debug('Control enters VisualForce Component code block');

     pendingOrder = new List<Sales_Order__c>();

     recentDespatch = new List<Sales_Order__c>();

     pending1 = new List<Sales_Order__c>();

     despatch1 = new List<Sales_Order__c>();

     accId = ApexPages.currentPage().getParameters().get('id');

     System.debug('Account ID'+accId);

   

     Account acc1 = new Account();

     acc1 = [SELECT Name FROM Account WHERE id=: accId];

     name = acc1.Name;

   

     pendingOrder = [ select PO_No__c, Balance_Quantity__c, Product_Description__c, Sales_Order_Status__c, Current_Despatch_Date_2__c from Sales_Order__c WHERE Account_Name__c =: accId AND (Sales_Order_Status__c != 'Closed') ORDER BY Current_Despatch_Date_2__c ];

   

  System.debug('Queried from Pending Order visual component:'+pendingorder);

   

 for( Sales_Order__c so1 : pendingOrder ){

       pending1.add(so1);

       system.debug('Pending1:'+pending1);

     }

    

recentDespatch = [select  PO_No__c, Invoice__r.Name, Quote_Quantity__c, Invoiced_Quantity__c, PO_Quantity__c, Product_Description__c, Tentative_Despatch_Date__c, Sales_Order_Status__c  FROM Sales_Order__c WHERE Account_Name__c =: accId AND Actual_Despatch_Date_Time__c != Null AND (Sales_Order_Status__c LIKE 'Closed') ORDER BY Tentative_Despatch_Date__c asc limit 10 ];

 

 System.debug('Queried from Recent Despatch visual force component:'+recentDespatch); 

 for( Sales_Order__c so2 : recentDespatch ){

     despatch1.add(so2);

      system.debug('Despatch1:'+despatch1);

     } 

     return null;

  } 

 }

HI. I have a requirement to send email with some data in the email. For this I have written the following:

1. Apex class

2. Visual Force page.

3. VisualForce Component.

4. Email Template

5. Button in the object.

 

It should work something like this: When the button, called as Order Status, is clicked the controller should query the data from the database and it should be displayed in the VisualForce page. This is working fine.

In the VisualForce page I have created 2 buttons, namely, Send Email and Cancel. On click of the "Send Email" button an email should be sent. This is also working fine but the email being sent is going without any data i.e. the queried is not being populated. In the VisualForce Page it is working fine but not in the VisualForce Component.

 

Please help. I am trying this since 5-6days and still no change.

I have created an Email Template and tosend an email using this template:

The from section of the email is: admin@gmail.com.

 

I want to change the from email id address.

How can I change the From Email Id?

 

I even changed the Author of the Email Template but still no change.

 

Can anyone help me? Pls.

I have used the following statement to send an email

 

Messaging.SingleEmailMessage email1 = new Messaging.SingleEmailMessage()

 

 

For this I have created a dummy record in the Contact object

 

 Contact c = new Contact( AccountId = accId,LastName = 'Testa',Email='abhijeet.p@algypug.com',CurrencyIsoCode = 'INR',MobilePhone = '9886098860',Credit_Report__c = 'NO');
   insert c;


Now after sending the email I delete this record as below:

 

Messaging.SendEmailResult [] r =  Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email1});
delete c;   

 

 

The problem here is this record is not getting deleted. Due to this I have created some 50+ dummy records in the Contact object.

Where am I wrong?

Am getting an error msg when I try keying in the correct values in a record w.r.t a validation rule. The error msg is:



system.security.NoAccessException: Entity Object cannot be initialized with null EntityInfo

Am getting an error msg when I try keying in the correct values in a record w.r.t a validation rule. The error msg is:

 

system.security.NoAccessException: Entity Object cannot be initialized with null EntityInfo

Am deploying an object( from Sandbox to Production) so do I need to include custom object, all the fields, validation rules, record types, page layouts, etc individually into the change set?

Or is it enough if I just include the custom object in the change set?

Is it possible to deploy multiple objects and all their related fields, etc using a single change set?

 

How does this deployment process work?

 

Abhijeet

I am writing a workflow which should trigger an email when following conditions are satisfied:

 

Status of a picklist field is not changed for 7days OR value of the text field is not changed for 7days.

 

This is the formula that I have framed:

 

AND( NOT(ISCHANGED(Brand__c)),  NOT(ISCHANGED(Comment__c)),  IF((Last_Field_Change__c =Last_Field_Change__c+7),TRUE,FALSE ))

 

Here, Brand__c is a picklist field, Comment__c is a text field and Last_Field_Change__c is a date/time field which stores LastModified Date/Time of Brand__c or Comment__c.

 

Can anybody help me?

I am writing a workflow which should trigger an email when following conditions are satisfied:

 

Status of a picklist field is not changed for 7days OR Status of the text field is not changed for 7days.

 

This is the formula that I have framed:

 

AND( NOT(ISCHANGED(Brand__c)),  NOT(ISCHANGED(Comment__c)),  IF((Last_Field_Change__c =Last_Field_Change__c+7),TRUE,FALSE ))

 

Can anybody help me?

To convert a Look Up field to Master Detail field:

 

1. I have created a dummy record in the master object and have populated this record into all the records of Detail object.

2. Changed the field type from LookUp to Master-Detail successfully.

 

Now can I delete that dummy record from the Master object? If yes then will it not affect/delete the existing USEFULL RECORDS from the Detail Object?

 

 

Abhijeet

How to convert a look up field to master-detail field type?

There are some records in the object. I am getting this error msg:

populate the lookup field with data in all records and then change the relationship type to Master-Detail.

 

 

How to populate the lookup field with data in all records?

 

 

There is a statement called

 

so.Last_Stage_Change__c = system.now();

system.debug('Current time:'so.Last_Stage_Change__c);

 

 

and the value of so.Last_Stage_Change__c should be today's date and time which is 10/4/2012 hh:mm:ss

 

but am getting yesterday's date and time. I mean the value which is being assigned to so.Last_Stage_Change__c is 10/3/2012 hh:mm:ss

 

Can anyone tell me what is the problem here and how does this system.now() work?

 

 

 

 

I have written a trigger to update a date/time field called Last_Stage_Change__c by system.now().

In the test class I used:

 

system.assertEquals(system.now(), obj.Last_Stage_Change__c);

 

Am getting an error msg saying

Expected: 10/4/2012 12:28:36pm, Actual: 10/4/2012 12:28:37pm.

 

 

That is the difference between Expected and Actual is one second.

 

What to do?

I am trying to update the value of a date / time field called as Last_Stage_Change__c by system.now(). When ever there is a change in value of a field called Sales_Order_Status__c then the field Last_Stage_Change__c should be updated. Both the fields belong to the the same object called Sales_Order__c. Here, Sales_Order_Status__c is a picklist field.

This is the code:

trigger UpdateField_LastStageChange on Sales_Order__c (after insert, after update) {
        List <Sales_Order__c> statusInsert = new List<Sales_Order__c>();
        List <Sales_Order__c> statusUpdate = new List<Sales_Order__c>();
        if(trigger.isInsert){
            for(Sales_Order__c so1:trigger.new){
                if( so1.Sales_Order_Status__c!=Null){
                    so1.Last_Stage_Change__c = system.now();
                    statusInsert.add(so1);
             } }
            update statusInsert;
            System.debug('last Stage Change Date/Time during Insert:'+statusInsert);
        } else if(trigger.isUpdate){
            for(Sales_Order__c so2:trigger.new){
                if(so2.Sales_Order_Status__c!=Null && so2.Sales_Order_Status__c!=trigger.oldMap.get(so2.id).Sales_order_Status__c){
                    so2.Last_Stage_Change__c = system.now();
                    statusUpdate.add(so2);
          } } update statusUpdate;
            System.debug('last Stage Change Date/Time during update:'+statusUpdate);
        } }

  I got an error message:

This is the error message: Error:Apex trigger UpdateField_LastStageChange caused an unexpected exception, contact your administrator: UpdateField_LastStageChange: execution of AfterUpdate caused by: System.FinalException: Record is read-only: Trigger.UpdateField_LastStageChange. How to solve this problem?

 Is it possible to replace the above trigger just by setting the default value of the field Last_Stage_Change__c to NOW()?

 Everytime the field is queried it will run the NOW() method and give the desired result.

 

I am trying to run a test class and I got this error message. What does it mean?

 

The problem here is there is no such  field with the API name as Standard Price or there is no validation rule with message as STANDARD_PRICE_NOT_DEFINED.

 

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

HI. Am trying to update immediately previous record from a value of the current record.  The field is End__c which is of type date / time. Given below is the code. Its not working. Can anyone help pls.

 

trigger EndTimeUpdate on Sales_Order_Status_History__c(after insert){
/* List <Sales_Order_Status_History__c> soshList = [SELECT update__c FROM Sales_Order_Status_History__c WHERE Id=: ApexPages.currentPage().GetParameters().get('Id')]; */
Sales_Order_Status_History__c sosh3 = [SELECT update__c FROM Sales_Order_Status_History__c WHERE Id=: ApexPages.currentPage().GetParameters().get('Id')];
Sales_Order_Status_History__c sosh; 
Sales_Order_Status_History__c sosh2;
if(trigger.isInsert){
for(Sales_Order_Status_History__c sosh1: trigger.old){
if(trigger.oldMap.get(sosh2.id).End__c == Null){
// trigger.oldMap.get(sosh2.id).End__c = soshList.update__c; 
trigger.oldMap.get(sosh2.id).End__c = sosh3.update__c;
}
}
update sosh2;
}
}

There are 3 objects BOQ(BOM__c), BOQ Item(BOM_Item__c), Quote Line Item.

There is a Master_Detail relationship between BOQ and BOQ Item. BOQ being Master.

There is a LookUp relationship between BOQ and Quote Line Item.

There are two fields, among other fields, in the BOQ Item: Record_Type__c is a picklist field with the values "Bought-Out Item" and "Processed Item"; and BOQ_Quantity__c which is a number field.

There is a picklist field called Rate_Basis__c in Quote Line Item with the values "Per Kg" and "Per Unit".

 

Requirement: I was asked to create a workflow on BOQ Item object to update the BOQ_Quantity__c field by some value iff

Record_Type__c = "Bought-Out Item" and Rate_Basis__c = "Per Kg"

and iff

Record_Type__c = "Bought-Out Item" and Rate_Basis__c = "Per Unit"

then BOQ_Quantity__c = some other value.

 

I created 2 WorkFlows as below:

 

Workflow 1: Rule Name   BOQ Quantity: PER KG

 

              Rule Criteria   AND( ISPICKVAL( Record_Type__c , "Bought-Out Item"), 
ISPICKVAL( BOM__r.Quote_Lookup__r.Rate_Basis__c, "Per Kg") )

 

              Evaluation Criteria  Evaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria

 

               Immediate Workflow Actions

               Field Update
                            BOQ_Quantity__c = Some value1.

 

Workflow 2: Rule Name   BOQ Quantity: PER UNIT

 

              Rule Criteria   AND( ISPICKVAL( Record_Type__c , "Bought-Out Item"), 
ISPICKVAL( BOM__r.Quote_Lookup__r.Rate_Basis__c, "Per Unit") )

              Evaluation Criteria  Evaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria

 

               Immediate Workflow Actions

               Field Update
                            BOQ_Quantity__c = Some value2.

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

Its not working. The Workflows are not triggering any values. What to do?

 

There are 3 objects:

 

1. Quote: Standard Object

2. Quote Line Item: Standard object

3. BOQ Item: Custom object.

 

 

i>  BOQ Item is in a Master Detail relationship with BOQ. BOQ Item is detail object in the relationship.

ii> BOQ is in a look up relationship with Quote Line Item.

iii> There is a picklist field in the Quote Line Item called Rate Basis.

iv> I have created a formula field in the BOQ Item with the following formula:

Text(BOQ__c.Quote_Lookup__r.Rate_Basis__c)

 

There are no errors in the formula but at the same time no value is getting displayed.

 

 

What could be the problem?

Kindly help

 

Abhijeet

HI. I have a requirement to send email with some data in the email. For this I have written the following:

1. Apex class

2. Visual Force page.

3. VisualForce Component.

4. Email Template

5. Button in the object.

 

It should work something like this: When the button, called as Order Status, is clicked the controller should query the data from the database and it should be displayed in the VisualForce page. This is working fine.

In the VisualForce page I have created 2 buttons, namely, Send Email and Cancel. On click of the "Send Email" button an email should be sent. This is also working fine but the email being sent is going without any data i.e. the queried is not being populated. In the VisualForce Page it is working fine but not in the VisualForce Component.

 

Please help. I am trying this since 5-6days and still no change.

I have created an Email Template and tosend an email using this template:

The from section of the email is: admin@gmail.com.

 

I want to change the from email id address.

How can I change the From Email Id?

 

I even changed the Author of the Email Template but still no change.

 

Can anyone help me? Pls.

Am getting an error msg when I try keying in the correct values in a record w.r.t a validation rule. The error msg is:

 

system.security.NoAccessException: Entity Object cannot be initialized with null EntityInfo

Am deploying an object( from Sandbox to Production) so do I need to include custom object, all the fields, validation rules, record types, page layouts, etc individually into the change set?

Or is it enough if I just include the custom object in the change set?

Is it possible to deploy multiple objects and all their related fields, etc using a single change set?

 

How does this deployment process work?

 

Abhijeet

I am writing a workflow which should trigger an email when following conditions are satisfied:

 

Status of a picklist field is not changed for 7days OR value of the text field is not changed for 7days.

 

This is the formula that I have framed:

 

AND( NOT(ISCHANGED(Brand__c)),  NOT(ISCHANGED(Comment__c)),  IF((Last_Field_Change__c =Last_Field_Change__c+7),TRUE,FALSE ))

 

Here, Brand__c is a picklist field, Comment__c is a text field and Last_Field_Change__c is a date/time field which stores LastModified Date/Time of Brand__c or Comment__c.

 

Can anybody help me?

I am writing a workflow which should trigger an email when following conditions are satisfied:

 

Status of a picklist field is not changed for 7days OR Status of the text field is not changed for 7days.

 

This is the formula that I have framed:

 

AND( NOT(ISCHANGED(Brand__c)),  NOT(ISCHANGED(Comment__c)),  IF((Last_Field_Change__c =Last_Field_Change__c+7),TRUE,FALSE ))

 

Can anybody help me?

I'm new to developing in general and am trying to create a trigger that updates the custom lookup field Market_lookup__c with the value selected in the field Market_picklist__c. Both fields reside in the standard Opportunity object, and the Market_lookup__c field points to the standard Account object. What I came up with is:

 

1
2
3
4
trigger OpptyMktTrigger on Opportunity (before insert, before update) {
    for (Opportunity a: Trigger.new)
            a.Market_lookup__c = a.Market_picklist__c;
}

 

But running this trigger returns the error: OpptyMktTrigger: execution of BeforeUpdate caused by: System.StringException: Invalid id: Market 1: Trigger.OpptyMktTrigger: line 3, column 1

 

I'm sure it's a simple fix. Can anyone help?