• nksf
  • NEWBIE
  • 139 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 46
    Questions
  • 66
    Replies
I am trying to create a formula field but reaching the character limit. Here is my formula below. As you see I am repeating same criteria with multiple IF Conditions. I believe we can reduce the characters if we apply AND/OR. Can someone please help me with this?

Formula:
IF(
AND(DoNotCall = False,
ISPICKVAL(Status__c, "Active"),
Owner.UserRole.Name = "MI Inside Sales Manager",
(NOT ISBLANK(TEXT(Origination_Volume_Ranking__c)) || NOT ISBLANK(TEXT(Submitter_Volume_Ranking__c))),
(How_are_the_retail_decisions_made__c = "Best Ex Inefficient" || How_are_the_retail_decisions_made__c = "Service/Relationship"),
Centralized__c <> "Yes"), "30 Day IS MI Only",

IF(
AND(DoNotCall = False,
ISPICKVAL(Status__c, "Active"),
Owner.UserRole.Name = "MI Inside Sales Manager",
(NOT ISBLANK(TEXT(Origination_Volume_Ranking__c)) || NOT ISBLANK(TEXT(Submitter_Volume_Ranking__c))),
(How_are_the_retail_decisions_made__c = "Best Ex Inefficient" || How_are_the_retail_decisions_made__c = "Service/Relationship"),
Centralized__c = "Yes"), "30 Day IS MI-Title",

IF(
AND(DoNotCall = False,
ISPICKVAL(Status__c, "Active"),
Owner.UserRole.Name = "MI Inside Sales Manager", 
(NOT ISBLANK(TEXT(Origination_Volume_Ranking__c)) || NOT ISBLANK(TEXT(Submitter_Volume_Ranking__c))), 
How_are_the_retail_decisions_made__c = "Best Ex Efficient"), "60 Day IS",

IF(
AND(DoNotCall = False,
ISPICKVAL(Status__c, "Active"),
Owner.UserRole.Name = "MI Inside Sales Manager",
(ISBLANK(TEXT(Origination_Volume_Ranking__c)) || ISBLANK(TEXT(Submitter_Volume_Ranking__c))),
(ISPICKVAL(Job_function__c, "Executive") || ISPICKVAL(Job_function__c, "Manager") || ISPICKVAL(Job_function__c, "Branch Manager") || ISPICKVAL(Job_function__c, "Regional Manager") || ISPICKVAL(Job_function__c, "Trainer"))), "90 Day IS",  

""))))
  • February 08, 2021
  • Like
  • 0
Hi Guys, 
I am not a developer and I need your help with Apex Class which I want to schedule to run on every Monday morning which will send email with a email template to all the public group members. I also need your help with the test class.

May be you can suggest any better option. All I want to send out the links of 3 Reports I have to certain users every Monday morning. I was thinking of using workflow rule or process builder but I am not sure what would be the criteria and how the WF Rule will run? 

 
  • January 03, 2018
  • Like
  • 0
Hi,
I need help with text formula field. I need to display text value in formula field based on the Profile. Is there a way I can create custom setting which include multiple Profiles total 34 of them and then create formula field based on the Custom Settings? If these 34 Profiles are in Custom Settings then show Text in Formula Field as "SSO Profile". If Profile Name is not in Custom Settings then show Text in Formula Field as "Non-SSO Profile". 
If it is not possible then what would the Formula I have to enter in Formula Field so I don't reach the limit. I am trying to create one but I am exceeding the limit. I am also having issue using OR in IF Condition. 

I prefer to have Custom Settings so I can Add/Remove Profiles from there without changing the Formula. 

Thanks in advance!
  • October 23, 2017
  • Like
  • 0
Hi Guys,
Is there a way to create a report only for recurring tasks and events? How can I distiguish between a "Series" and single entries in Activity Report?
  • October 19, 2017
  • Like
  • 0
Hi,
If I login with login.salesforce.com then I need to display salesforce instance url like https://na30.salesforce.com instead of Domain Name for few of our users. We have enabled Single Sign-On and some of the users are not going to use SSO. So they will be using login.salesforce.com to login to Salesforce with their credentials. But as soon they login to Salesforce our Domain Name displays on URL. Can it be displayed as https://na30.salesforce.com instead of Domain Name if any user logs in with login.salesforce.com?
For the SSO users I do want my Domain URL to be displayed. 
  • October 19, 2017
  • Like
  • 0
We have multiple Sandboxes and it is a painful process to deactivate user in all the sandboxes. What are the best options to deactivate user in all sandboxes. If you think that there is a code involved please help me with the code because I am not a developer. 
Thanks in advance!
  • August 14, 2017
  • Like
  • 0
Hi Guy,
Can you please guide me the possible solution/workaround for a issue I have? One of our Customer has a Rule setup that they don't Accept Emails where Sender Email Address has more than 100 Characters. So whenever we send them Email regarding Salesforce Case from Case Object sometime it fails to deliver because Salesforce generates too long Sender Email Address which exceeds 100 characters.
I have pulled email log and some sender addresses are short and some are more than 100 characters. Why there is length/format difference? Is there any solution/workaround for this issue?   

Thanks!
  • April 25, 2017
  • Like
  • 0
Hi Guys,
Can you please help me with a Trigger. We have Custom Object called Tax Info and we have lookup field to Order Object and Lookup field to Account Object Tax Info Custom Object. We also have few more custom fields on Tax Info but Tax ID field is required field and it needs to be populated. I need to write a Trigger that whenever we create New Order then Tax Info record needs to be created/associated to the Order.
Step 1: First we need to look for the existing Tax Info Record off the related Account on Order. If we find existing record then we don't need to create new Tax Info Record. Just associate the existing Tax Info Record to that Order which will also appear on Order Page Tax Info Related List.
Step 2: If there is no existing Tax Info Record off the related Account on Order then we need to create new Tax Info record which will also appear on Order Page Tax Info Related List and Pouplate Order Numer, Account Name and Tax ID on this new record. 
Please let me know if you have any questions.
Thanks in advance!!!!
  • March 18, 2017
  • Like
  • 0
Hi Guys,
I need your help to right a formula which I want to use in my workflow rule. Formula should be if Now() the time is < 4 p.m. EST then set the date as Today() and if Now() the time is > 4 p.m. EST then set the date as tomorrow's Date. 

Thanks!!!
  • October 04, 2016
  • Like
  • 0
Hi Guys,
I need your help that how can I create a custom button on list view to run the batch class.
Right now I go to developer console and click on Debug and click on Open Execute Anonymous Window and then I enter Database.executeBatch(new CreateOrderBatch(),1); and then execute it. When I execute it then it makes a API call.
Is there a way I can just click on the Custom Button on List View and it makes API calls instead of going Developer Console?

Thanks!
  • November 03, 2015
  • Like
  • 0
Hi Guys I need your help with this Date Formula Field. It is very urgent
Here is my Formula
IF(Billing_Frequency__c = "M" && Today()> PurchaseDate && Today()< UsageEndDate, DATE(IF(Month(PurchaseDate)= 12, YEAR(Today())+1,YEAR(Today())), (MONTH(PurchaseDate)+ FLOOR((Today()- PurchaseDate) / 31)+ 1), DAY(PurchaseDate)), 
IF(Billing_Frequency__c = "M" && Today() <= PurchaseDate && Today()< UsageEndDate, PurchaseDate, NULL))

This Formula is working fine if Year of PurchaseDate is 2015 or above but if Year of PurchaseDate is 2014 then I am getting #Error! value.
Can you please let me know what I am doing wrong? Once again it is very urgent. Thanks in advance!!!
 
  • October 02, 2015
  • Like
  • 0
Hi Guys I need your help with this Formula field. It is very urgent.
We have Formula Field Billing Frequency and we have PurchaseDate Standard Date Field
I need to create a Formula Field to Calculate the Future Bill Date
Scenario:
If we have Billing_Frequency__c = Monthly and PurchaseDate = 8/1/15 and EndDate = 12/1/15 
Suppose Today() Date is 9/23/15
then if Today() Date is > PurchaseDate and < EndDate then this Formula Field should show Future Bill Date as 10/1/15 
so when Today() Date be 10/2/15 then this Formula Field should show Future Date as 11/1/15
If Today() Date is <= PurachaseDate then this Formula Field show just show PurchaseDate
In case Today()Date is < EndDate then this Field should be Blank.

If we have Billing_Frequency__c = Quarterly and PurchaseDate = 8/1/15 and EndDate = 12/1/16 
Suppose Today() Date is 9/23/15
then if Today() Date is > PurchaseDate and < EndDate then this Formula Field should show Future Bill Date as 2/1/16
so when Today() Date be 2/2/16 then this Formula Field should show Future Date as 5/1/16
If Today() Date is <= PurachaseDate then this Formula Field show just show PurchaseDate
In case Today()Date is < EndDate then this Field should be Blank.
 
  • September 23, 2015
  • Like
  • 0
Hi guys I need your help to get future bill date by formula field. It is very urgent. 
1st Scenario:
If Billing Frequency Custom Field = Monthly
and Purchase Date Field = 9/01/2015 then this formula field should show Future Bill Date = 10/01/2015
So when Today date is Greater Than(Passes) 10/01/2015 then Future Bill Date should show as 11/01/2015.
Example: Suppose today's Date is 9/22/15 and we have Purchase Date Field = 7/5/15 so Future Bill Date should be showing 10/05/15 and on Date 10/6/15 the Future Bill Date should be showing 11/05/15

2nd Scenario:
If Billing Frequency Custom Field = Quarterly
and Purchase Date Field = 9/01/2015 then this formula field should show Future Bill Date = 12/01/2015 
So when Today date is Greater Than(Passes) 12/01/2015 then Future Bill Date should show as 3/01/2015.
Example: Suppose today's Date is 9/22/15 and we have Purchase Date Field = 7/5/15 so Future Bill Date should be showing 10/05/15 and on Date 10/6/15 the Future Bill Date should be showing 1/05/15
  • September 22, 2015
  • Like
  • 0
HI guys,
I need to create Custom Delete Button. I belive it requires Java Script and I need your help with this.
I need this Button on Activity Object (Task and Events) 
We have multiple Record Types of Activity Object. But I need this button on only 1 page layout related to one of the Record Type. 
Example: 
Object Name: Activity
Record Type Names: Record Type A      Record Type B     Record Type C
So I need this button on Page Layout which is related to B Record Type
User Roles; Sales Rep Manager           Sales Rep Director 
Requirement is that only Users in Sales Rep Manager Role and Sales Rep Director Role and System Admins should be able Delete Activities using this Custom Delete Button. All other users should not be able to delete Activity Records using this button. 
  • September 11, 2015
  • Like
  • 0
Hi guys, I need you help with this strange scenario if you can suggest me anything.
We have same profile for Sales Reps and their Managers. We also have multiple record types and page layouts for Activities (Task and Events).
For one of the Record Type we dont want Sales Reps to have Delete Permission. Only thier Managers should be able to Delete Acitivites of this Record Type. We dont want to create seperate Profile for Managers and also dont want to write Trigger for this. Can you please suggest me anything to achieve this without new Profile and Trigger. 
Example: 
Profile Name: Sales Team
Users: Sales Reps        Managers     Directors
Object: Activity (Task and Events)
Record Type: A   B   C
Page Layout: A   B   C
For Record Type B we need to restrict Sales Reps to Delete these Activities but their Managers and above Role can Delete them. 
Sales Reps should still have the ability to Delete Activities of other Record Types A and C 
  • September 11, 2015
  • Like
  • 0
Hi Guys can you please help me out with this Trigger? We are using Managed Package and I am not able to update any Trigger in Managed Package.
We have Order custom object and whenever we update status of Order to Released then Invoice gets generated. We don't have any relationship between Order and Invoice Object. It is happening through the managed package. 
I need couple of Order Fields Values copy over to Invoice when the new invoice gets generated. 
Order Fields: Cancel Reason and Credit Reason     Invoice Fields: Cancel Reason and Credit Reason
So when Invoice gets generated it should copy Order Cancel and Credit Reason over to Invoice Cancel and Credit Reason

Any idea how it can be achieved?
  • August 12, 2015
  • Like
  • 0
Hi Guys,
Can you please help me with a Test Class? I am not a developer and trying to write a Test class for a Trigger I have but getting error. 
Trigger:

trigger ServiceLineBillingFrequency on kugo2p__SalesOrder__c (after update) {

Set<Id> OrderID = new Set<Id>();

 for(kugo2p__SalesOrder__c so : Trigger.new){
 OrderID.add(so.id);
}

List<kugo2p__SalesOrderServiceLine__c> SLUpdate = [select id, kugo2p__SalesOrder__c from kugo2p__SalesOrderServiceLine__c where kugo2p__SalesOrder__c in :OrderID];
 for(kugo2p__SalesOrder__c so : trigger.new){
 for (kugo2p__SalesOrderServiceLine__c osl : SLUpdate) {
 If(so.Order_Billing_Frequency__c != Null){

        osl.Billing_Frequency__c = so.Order_Billing_Frequency__c;
 }
}
}
update SLUpdate;
  }

Test Class:

@isTest
 public class BillingFrequency {
 static testMethod void InsertOrder(){
 
 Account acc = new Account();
 acc.Name = 'ABC';
 insert acc;
 
 kugo2p__SalesOrder__c SO = new kugo2p__SalesOrder__c();
 Account AccID = [Select id from Account where Name = 'ABC'];
 SO.kugo2p__Account__c = AccID.id;
 SO.CurrencyIsoCode = 'USD';
 SO.Order_Form_Type__c = 'New Order';
 SO.Renewal_Term_Exceptions__c = 'None';
 SO.Purchase_Order_Required__c = 'NO';
 SO.Renewal_Term_Notification__c = '30';
 SO.Order_Billing_Frequency__c = 'Monthly';
 insert SO;
 
 kugo2p__SalesOrderServiceLine__c SL = new kugo2p__SalesOrderServiceLine__c();
 SO =[Select id from kugo2p__SalesOrder__c where id = :SO.id];
 Sl.kugo2p__SalesOrder__c = SO.id;
 SL.kugo2p__Service__c = 'a2B40000000Lk85';
 SL.kugo2p__Quantity__c = 2;
 SL.CurrencyIsoCode = 'USD';
 date mydate = date.parse('08/03/2015');
 SL.kugo2p__DateServiceStart__c = mydate;
 insert SL;
 
 SO.kugo2p__RecordStatus__c = 'approved';
 update SO;
 }
 }

Error Message:
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, kugo2p.SalesOrderBeforeInsert: execution of BeforeInsert
caused by: System.NullPointerException: Attempt to de-reference a null object
(kugo2p)
Stack Trace Class.BillingFrequency.InsertOrder: line 18, column 1
  • August 03, 2015
  • Like
  • 0
Hi Guys,
Can you please help me out with this Trigger?
Whenever any record is created or edited on kugo2p__SalesOrder__c then it should copy kugo2p__BillingFrequency__c field value to other Custom Object I have kugo2p__SalesOrderServiceLine__c and the field name is Billing_Frequency__c. kugo2p__SalesOrderServiceLine__c is the Child of kugo2p__SalesOrder__c. 
Also this Trigger should only update field when on kugo2p__SalesOrder__c we have Order_Form_Type__c = New Order OR Upsell – Independent OR Upsell – Coterminous OR Organic Growth OR Credit OR Renewal OR Renewal – Entitlement Reconciliation OR New – Entitlement Reconciliation OR Upsell – Entitlement Reconciliation
  • July 30, 2015
  • Like
  • 0
Hi Guys I need your help with a Validation Rule. It is very urgent. 
Here is my Validation Rule
AND(ISCHANGED(OwnerId), Account_Management_Account__c = True, $UserRole.Id <> "00E4000000184OK", $UserRole.Id <> "00E40000000tCwV", $UserRole.Id = "00E40000000tlQS", $User.ProfileId <> "00e40000000oz3O", $User.ProfileId <> "00e30000000cGQI")

I am trying that if Any user try to change the owner and if Account Management Account Checkbox Formula Field is True and if User Role and User Profile are not equal to ******* then give a Validation Error. 
I have tried this Validation Rule and it is not working. Account Management Account is Formula Checkbox Field (Is this could be reason?)
Thanks in advance. 
  • July 02, 2015
  • Like
  • 0
Hi Guys,
Can you please help me out with a Trigger. I have a checkbox field on Account Page as Active_Contract__c and I need to update this field to True if this Account has any Active Contract. On Contract I have the same checkbox field as Active_Contract__c which tells us if contract is Active or not. So whenever we generate a Contract and set it as Active Contract then on its related Account Page Active Contract field should get updated to True.
If all the Contracts related to Account turns Inactive then Active Contract Field on Account Field should be updated to False. 

Also I need a script which I can run to update all the Accounts which have any active contracts.  

Thanks in advance. 
  • June 24, 2015
  • Like
  • 0
I am trying to create a formula field but reaching the character limit. Here is my formula below. As you see I am repeating same criteria with multiple IF Conditions. I believe we can reduce the characters if we apply AND/OR. Can someone please help me with this?

Formula:
IF(
AND(DoNotCall = False,
ISPICKVAL(Status__c, "Active"),
Owner.UserRole.Name = "MI Inside Sales Manager",
(NOT ISBLANK(TEXT(Origination_Volume_Ranking__c)) || NOT ISBLANK(TEXT(Submitter_Volume_Ranking__c))),
(How_are_the_retail_decisions_made__c = "Best Ex Inefficient" || How_are_the_retail_decisions_made__c = "Service/Relationship"),
Centralized__c <> "Yes"), "30 Day IS MI Only",

IF(
AND(DoNotCall = False,
ISPICKVAL(Status__c, "Active"),
Owner.UserRole.Name = "MI Inside Sales Manager",
(NOT ISBLANK(TEXT(Origination_Volume_Ranking__c)) || NOT ISBLANK(TEXT(Submitter_Volume_Ranking__c))),
(How_are_the_retail_decisions_made__c = "Best Ex Inefficient" || How_are_the_retail_decisions_made__c = "Service/Relationship"),
Centralized__c = "Yes"), "30 Day IS MI-Title",

IF(
AND(DoNotCall = False,
ISPICKVAL(Status__c, "Active"),
Owner.UserRole.Name = "MI Inside Sales Manager", 
(NOT ISBLANK(TEXT(Origination_Volume_Ranking__c)) || NOT ISBLANK(TEXT(Submitter_Volume_Ranking__c))), 
How_are_the_retail_decisions_made__c = "Best Ex Efficient"), "60 Day IS",

IF(
AND(DoNotCall = False,
ISPICKVAL(Status__c, "Active"),
Owner.UserRole.Name = "MI Inside Sales Manager",
(ISBLANK(TEXT(Origination_Volume_Ranking__c)) || ISBLANK(TEXT(Submitter_Volume_Ranking__c))),
(ISPICKVAL(Job_function__c, "Executive") || ISPICKVAL(Job_function__c, "Manager") || ISPICKVAL(Job_function__c, "Branch Manager") || ISPICKVAL(Job_function__c, "Regional Manager") || ISPICKVAL(Job_function__c, "Trainer"))), "90 Day IS",  

""))))
  • February 08, 2021
  • Like
  • 0
Hi Guys,
Is there a way to create a report only for recurring tasks and events? How can I distiguish between a "Series" and single entries in Activity Report?
  • October 19, 2017
  • Like
  • 0
Hi,
If I login with login.salesforce.com then I need to display salesforce instance url like https://na30.salesforce.com instead of Domain Name for few of our users. We have enabled Single Sign-On and some of the users are not going to use SSO. So they will be using login.salesforce.com to login to Salesforce with their credentials. But as soon they login to Salesforce our Domain Name displays on URL. Can it be displayed as https://na30.salesforce.com instead of Domain Name if any user logs in with login.salesforce.com?
For the SSO users I do want my Domain URL to be displayed. 
  • October 19, 2017
  • Like
  • 0
We have multiple Sandboxes and it is a painful process to deactivate user in all the sandboxes. What are the best options to deactivate user in all sandboxes. If you think that there is a code involved please help me with the code because I am not a developer. 
Thanks in advance!
  • August 14, 2017
  • Like
  • 0
Hi Guys,
Can you please help me with a Trigger. We have Custom Object called Tax Info and we have lookup field to Order Object and Lookup field to Account Object Tax Info Custom Object. We also have few more custom fields on Tax Info but Tax ID field is required field and it needs to be populated. I need to write a Trigger that whenever we create New Order then Tax Info record needs to be created/associated to the Order.
Step 1: First we need to look for the existing Tax Info Record off the related Account on Order. If we find existing record then we don't need to create new Tax Info Record. Just associate the existing Tax Info Record to that Order which will also appear on Order Page Tax Info Related List.
Step 2: If there is no existing Tax Info Record off the related Account on Order then we need to create new Tax Info record which will also appear on Order Page Tax Info Related List and Pouplate Order Numer, Account Name and Tax ID on this new record. 
Please let me know if you have any questions.
Thanks in advance!!!!
  • March 18, 2017
  • Like
  • 0
Hi Guys,
I need your help to right a formula which I want to use in my workflow rule. Formula should be if Now() the time is < 4 p.m. EST then set the date as Today() and if Now() the time is > 4 p.m. EST then set the date as tomorrow's Date. 

Thanks!!!
  • October 04, 2016
  • Like
  • 0
Hi Guys I need your help with this Date Formula Field. It is very urgent
Here is my Formula
IF(Billing_Frequency__c = "M" && Today()> PurchaseDate && Today()< UsageEndDate, DATE(IF(Month(PurchaseDate)= 12, YEAR(Today())+1,YEAR(Today())), (MONTH(PurchaseDate)+ FLOOR((Today()- PurchaseDate) / 31)+ 1), DAY(PurchaseDate)), 
IF(Billing_Frequency__c = "M" && Today() <= PurchaseDate && Today()< UsageEndDate, PurchaseDate, NULL))

This Formula is working fine if Year of PurchaseDate is 2015 or above but if Year of PurchaseDate is 2014 then I am getting #Error! value.
Can you please let me know what I am doing wrong? Once again it is very urgent. Thanks in advance!!!
 
  • October 02, 2015
  • Like
  • 0
Hi guys I need your help to get future bill date by formula field. It is very urgent. 
1st Scenario:
If Billing Frequency Custom Field = Monthly
and Purchase Date Field = 9/01/2015 then this formula field should show Future Bill Date = 10/01/2015
So when Today date is Greater Than(Passes) 10/01/2015 then Future Bill Date should show as 11/01/2015.
Example: Suppose today's Date is 9/22/15 and we have Purchase Date Field = 7/5/15 so Future Bill Date should be showing 10/05/15 and on Date 10/6/15 the Future Bill Date should be showing 11/05/15

2nd Scenario:
If Billing Frequency Custom Field = Quarterly
and Purchase Date Field = 9/01/2015 then this formula field should show Future Bill Date = 12/01/2015 
So when Today date is Greater Than(Passes) 12/01/2015 then Future Bill Date should show as 3/01/2015.
Example: Suppose today's Date is 9/22/15 and we have Purchase Date Field = 7/5/15 so Future Bill Date should be showing 10/05/15 and on Date 10/6/15 the Future Bill Date should be showing 1/05/15
  • September 22, 2015
  • Like
  • 0
Hi Guys can you please help me out with this Trigger? We are using Managed Package and I am not able to update any Trigger in Managed Package.
We have Order custom object and whenever we update status of Order to Released then Invoice gets generated. We don't have any relationship between Order and Invoice Object. It is happening through the managed package. 
I need couple of Order Fields Values copy over to Invoice when the new invoice gets generated. 
Order Fields: Cancel Reason and Credit Reason     Invoice Fields: Cancel Reason and Credit Reason
So when Invoice gets generated it should copy Order Cancel and Credit Reason over to Invoice Cancel and Credit Reason

Any idea how it can be achieved?
  • August 12, 2015
  • Like
  • 0
Hi Guys,
Can you please help me with a Test Class? I am not a developer and trying to write a Test class for a Trigger I have but getting error. 
Trigger:

trigger ServiceLineBillingFrequency on kugo2p__SalesOrder__c (after update) {

Set<Id> OrderID = new Set<Id>();

 for(kugo2p__SalesOrder__c so : Trigger.new){
 OrderID.add(so.id);
}

List<kugo2p__SalesOrderServiceLine__c> SLUpdate = [select id, kugo2p__SalesOrder__c from kugo2p__SalesOrderServiceLine__c where kugo2p__SalesOrder__c in :OrderID];
 for(kugo2p__SalesOrder__c so : trigger.new){
 for (kugo2p__SalesOrderServiceLine__c osl : SLUpdate) {
 If(so.Order_Billing_Frequency__c != Null){

        osl.Billing_Frequency__c = so.Order_Billing_Frequency__c;
 }
}
}
update SLUpdate;
  }

Test Class:

@isTest
 public class BillingFrequency {
 static testMethod void InsertOrder(){
 
 Account acc = new Account();
 acc.Name = 'ABC';
 insert acc;
 
 kugo2p__SalesOrder__c SO = new kugo2p__SalesOrder__c();
 Account AccID = [Select id from Account where Name = 'ABC'];
 SO.kugo2p__Account__c = AccID.id;
 SO.CurrencyIsoCode = 'USD';
 SO.Order_Form_Type__c = 'New Order';
 SO.Renewal_Term_Exceptions__c = 'None';
 SO.Purchase_Order_Required__c = 'NO';
 SO.Renewal_Term_Notification__c = '30';
 SO.Order_Billing_Frequency__c = 'Monthly';
 insert SO;
 
 kugo2p__SalesOrderServiceLine__c SL = new kugo2p__SalesOrderServiceLine__c();
 SO =[Select id from kugo2p__SalesOrder__c where id = :SO.id];
 Sl.kugo2p__SalesOrder__c = SO.id;
 SL.kugo2p__Service__c = 'a2B40000000Lk85';
 SL.kugo2p__Quantity__c = 2;
 SL.CurrencyIsoCode = 'USD';
 date mydate = date.parse('08/03/2015');
 SL.kugo2p__DateServiceStart__c = mydate;
 insert SL;
 
 SO.kugo2p__RecordStatus__c = 'approved';
 update SO;
 }
 }

Error Message:
System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, kugo2p.SalesOrderBeforeInsert: execution of BeforeInsert
caused by: System.NullPointerException: Attempt to de-reference a null object
(kugo2p)
Stack Trace Class.BillingFrequency.InsertOrder: line 18, column 1
  • August 03, 2015
  • Like
  • 0