• Sindhu1234
  • NEWBIE
  • 139 Points
  • Member since 2014
  • SSA
  • Focus

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 8
    Likes Given
  • 3
    Questions
  • 31
    Replies
I need to create an automated tasks based on task created date. 

For example. Task create date is 20/07/2016 , Here i want create another task after 15 days but here I need to check the business days. I need to exclude the saturday and sunday.

Please let me  know how to acheive this.
 
Hello, is it possible to assign 3 record types for instance as a picklist available when an Account is created.
Basically I want to have 3 different types of Accounts and for each, one record type. The main question is how can I assign these record types to Accounts and how can I choose between those when/before creating an Account ?

Thanks in advance :)
Hi Developer,

I have written a sample piece of code .Here it is 

Public class TotalPrice_cls{
public static void calTotal(Book__c[] b)
{
for(Book__c[] s: b)
s.Total_Price__c = s.Price__c* s.Quantity__c;

}
}
While running the code it displays the error message as :Error: Initial term of field expression must be a concrete SObject: LIST<Book__c> at line 9 column 1.
May i know the reason for this error message. Thanks in advance.
I have developed an Inbound webservice .Where i receive an xml which contains multiple records.I'm wondering where i'm missing the bulk records. My code works fine for one record but fails to handle multiple records. here is the code /* GAP 7

*/

global with sharing class CreditGap7 {
  webservice static string UpdateAccounts( string xml){
    
    Savepoint sp = Database.setSavepoint( );
        CreditRecords deb = new CreditRecords( );
        string creditRecordsId;
        System.debug('The Xml data is:'+xml);
        /*xml = <xml> <DebtorNavCreditMsg><SFDCAccountId>001L000000cWq8IIAS</SFDCAccountId>
                      <CreditStatus>Blocked</CreditStatus>
                      <PaymentTerms> 12 </PaymentTerms>
                      <CreditLimit>123.2</CreditLimit>
                      <DebtorId>C23456767</DebtorId>
                      <Status>Sucess </Status>
                        <Skey>11  </Skey>
                      
             </DebtorNavCreditMsg>
<DebtorNavCreditMsg><SFDCAccountId>001L000000cWq8IIAS</SFDCAccountId>
                      <CreditStatus>Blocked</CreditStatus>
                      <PaymentTerms> 12 </PaymentTerms>
                      <CreditLimit>123.2</CreditLimit>
                      <DebtorId>6767</DebtorId>
                      <Status>Sucess </Status>
                        <Skey>113  </Skey>
                      
             </DebtorNavCreditMsg> */ 
        
  
   Advanced_Log__c log = new Advanced_Log__c( );//Creating Advanced log record with received xml string
        log.Received_Data_Stream__c = xml != null && xml != '' ? xml : 'XML is empty.';
        log.Log_Type__c = 'System';
        log.Process_Name__c = 'GAP7';
        log.Status__c = 'New';
        log.User_Id__c = UserInfo.getUserId( );
  
  try
        {
           
            if ( xml == null || xml == '' )
                return 'XML is empty.';
            
             XMLParser( addCDataNodes(xml), deb );
           // System.debug('The Pharsed deb xml is:'+deb);
            if ( deb.SFDCAccountId == ''  )// Id is empty  throwing error.
             {
                log.Log_Message__c = ' SFDCAccountID is required.';
                log.Log_Level__c = 'Error';
                insert log;
                
                return '<SFDCAccountID>' +deb.SFDCAccountId+ '</SFDCAccountID><CreditStatus>' +deb.CreditStatus + '</CreditStatus>'+
                      '<PaymentTerms> '+deb.PaymentTerms+' </PaymentTerms><CreditLimit>'+deb.CreditLimit+'</CreditLimit><Status>Failure</Status>'+
                    '<Message>DebtorNavCreditMsg.SFDCAccountID is empty</Message>';
             }
             List<ERP_Customer_Record__c>debRecords = [select Id,Account__c,Credit_Status__c,Payment_Terms__c,Credit_Limit__c from ERP_Customer_Record__c where  Account__c=:deb.SFDCAccountID];
            System.debug('The deb record is:'+debRecords); 
            if ( !debRecords.isEmpty( ) && debRecords.size() > 0 )
                {
                    ERP_Customer_Record__c creditRecords = debRecords[ 0 ];
                    log.ERPAccountId__c = creditRecords.Id;
                   creditRecordsId  = creditRecords.Id;
                    //Replace CustomerCreditCheck with the tag provided by LX
                    creditRecords = new ERP_Customer_Record__c( Id = creditRecordsId,Account__c = deb.SFDCAccountId,Credit_Status__c = deb.CreditStatus,Payment_Terms__c = deb.PaymentTerms,Credit_Limit__c = deb.CreditLimit != '' ? decimal.valueOf( deb.CreditLimit.trim() ) : null ,CreditLastModified__c = system.now());
                    update creditRecords;
                    
                     log.Log_Message__c = deb.SFDCAccountId + ' (' + creditRecordsId + ') updated successfully.';
                    log.Log_Level__c = 'Info';
                    insert log;//creating log record
                    
                    return '<SFDCAccountID>' + creditRecordsId + '</SFDCAccountID><Status>Success</Status>'+
                            '<Message>' + deb.SFDCAccountId + ' (' + creditRecordsId+ ') +updated successfully</Message>';
                }
                
                 else
              {
                log.Log_Message__c = 'The AccountId is needed to update the debCustomerRecords.';
                log.Log_Level__c = 'Notification';
                insert log;//creating log record
                
                return '<SFDCAccountID>' + creditRecordsId + '</SFDCAccountID><Status>Notification</Status>'+
                        '<Message>The AccountId is needed to update the debCustomerRecords.</Message>';
              }
        }
      catch( Exception ex )
        {
            Database.rollback( sp );//If any error occured rollback all transactions from DB
            
            log.ERPAccountId__c = creditRecordsId;
            log.Log_Message__c = ex.getMessage( ).length() > 200? deb.SFDCAccountId +' Exception: ' + ex.getMessage().substring(0,200):deb.SFDCAccountId + ' Exception: ' +ex.getMessage( );
            log.Log_Level__c = 'Error';
            insert log;//creating log record with exception message
            
            return '<SFDCAccountID>' + creditRecordsId + '</SFDCRecordID><Status>Failure</Status>'+
                        '<Message>Exception:' + ex.getMessage() + '</Message>';
        }
    }
  
    //This method parse the string and create the wrapper class object(ItemRecord)
    private static String addCDataNodes( String XmlString )
    {
        Pattern CDataSectionPattern = Pattern.compile('<!\\[CDATA\\[(.*?)\\]\\]>');
        Matcher m = CDataSectionPattern.matcher(XmlString);
        while (m.find())    //could be simplified with a replaceAll ? @todo
        {
            XmlString = XmlString.substring(0, m.start()) +
                '<CDataSection>'+
                m.group(1).escapeXml() +
                '</CDataSection>'
                +  XmlString.substring( m.end());
            m = CDataSectionPattern.matcher(XmlString);
        }
        return XmlString;
        
    }
    
    private static void XMLParser( string xml, CreditRecords deb )
    {
       Dom.Document doc = new Dom.Document();
        doc.load( xml );
  
        Dom.XMLNode DebtorNavCreditMsg = doc.getRootElement();
  for( Dom.XMLNode child1 : DebtorNavCreditMsg.getChildElements( ) )//looping all the child nodes from xml
        {
           // String Text1 = child1.getName();
            
            
            String test = child1.getName();
            System.debug('test child:'+Test);
           for( Dom.XMLNode child : child1.getChildElements( ) ) 
           {
               string Text = child.getName();
               System.debug('The node is :'+Text);
               
            if(Text == 'SFDCAccountID') 
            deb.SFDCAccountID = child.getText();
            if(Text == 'CreditStatus')  
            deb.CreditStatus = child.getText();
            if(Text == 'PaymentTerms')
            deb.PaymentTerms = child.getText();
            if(Text == 'CreditLimit')
            deb.CreditLimit = child.getText();
            
           }
            }
       
    }
    //Wrapper class for ItemMaster
    public class CreditRecords
    {
        public string CreditStatus{get;set;}
         public string SFDCAccountID{get;set;}
        public string PaymentTerms{get;set;}
        public string CreditLimit{get;set;}
       
    }       
             
  

}
I'm on Trailahead challege ,while coding came accross an error says "Invalid interface: Queueable".
Tried using "small q as queueable" but it doesn't resolved.Any clue where i am going wrong
//Queueable Apex

public class AddPrimaryContact implements Queueable

{
	private Contact c;

    private String state;

    public  AddPrimaryContact(Contact c, String state)

    {

        this.c = c;

        this.state = state;

    }

    public void execute(QueueableContext context)

    {

         List<Account> ListAccount = [SELECT ID, Name ,(Select id,FirstName,LastName from contacts ) FROM ACCOUNT WHERE BillingState = :state LIMIT 200];

         List<Contact> lstContact = new List<Contact>();

         for (Account acc:ListAccount)

         {

                 Contact cont = c.clone(false,false,false,false);

                 cont.AccountId =  acc.id;

                 lstContact.add( cont );

         }

          

         if(lstContact.size() >0 )

         {

             insert lstContact;

         }

              

    }

 

}

 
Here is the post on the developers best practice while writing some code. This sheet is an developers on go.
https://developer.salesforce.com/blogs/engineering/2015/05/developer-practices-checklist.html
Hi all,

I'm trying to create a validation rule for our phone numbers. Every number has 2 parts:

Country Code (numerical, 1 digit starts with '+') --> +1

Number (numerical, no digit limit, cannot start with 0)

Examples:

+12019841724

Thanks for help.
  • January 08, 2020
  • Like
  • 0
I need to create an automated tasks based on task created date. 

For example. Task create date is 20/07/2016 , Here i want create another task after 15 days but here I need to check the business days. I need to exclude the saturday and sunday.

Please let me  know how to acheive this.
 
Hi,
Below is the Schedule Class with Test Class:

Schedule Class:

global class DailyLeadProcessor implements Schedulable {

    global void execute(SchedulableContext ctx) {
        List<Lead> lList = [Select Id, LeadSource from Lead where LeadSource = null limit 200];
        list<lead> led = new list<lead>();
        if(!lList.isEmpty()) {
            for(Lead l: lList) {
                l.LeadSource = 'Dreamforce';
                led.add(l);
            }
            update led;
        }
    }
}

Test Class:

@isTest
public class DailyLeadProcessorTest{

    static testMethod void testMethod1() 
    {
                Test.startTest();
        
        List<Lead> lstLead = new List<Lead>();
        for(Integer i=0 ;i <200;i++)
        {
            Lead led = new Lead();
            led.FirstName ='FirstName';
            led.LastName ='LastName'+i;
            led.Company ='demo'+i;
            lstLead.add(led);
        }
        
        insert lstLead;
        
        DailyLeadProcessor ab = new DailyLeadProcessor();
         String jobId = System.schedule('jobName','0 5 * * * ? ' ,ab) ;
        
   
        Test.stopTest();
    }
}
Hi,
i am working on apex super badge.On the second check which called "Synchronize Salesforce data with an external system"
i have this error:
There was an unhandled exception. Please reference ID: NQMGPJRH. Error: ArgumentError. Message: bad argument (expected URI object or URI string)
when i run my code in anynomus its working.
 
I'm on Trailahead challege ,while coding came accross an error says "Invalid interface: Queueable".
Tried using "small q as queueable" but it doesn't resolved.Any clue where i am going wrong
//Queueable Apex

public class AddPrimaryContact implements Queueable

{
	private Contact c;

    private String state;

    public  AddPrimaryContact(Contact c, String state)

    {

        this.c = c;

        this.state = state;

    }

    public void execute(QueueableContext context)

    {

         List<Account> ListAccount = [SELECT ID, Name ,(Select id,FirstName,LastName from contacts ) FROM ACCOUNT WHERE BillingState = :state LIMIT 200];

         List<Contact> lstContact = new List<Contact>();

         for (Account acc:ListAccount)

         {

                 Contact cont = c.clone(false,false,false,false);

                 cont.AccountId =  acc.id;

                 lstContact.add( cont );

         }

          

         if(lstContact.size() >0 )

         {

             insert lstContact;

         }

              

    }

 

}

 
Hello, is it possible to assign 3 record types for instance as a picklist available when an Account is created.
Basically I want to have 3 different types of Accounts and for each, one record type. The main question is how can I assign these record types to Accounts and how can I choose between those when/before creating an Account ?

Thanks in advance :)
From Setup, enter “Bulk Data Load Jobs” in the Quick Find box, then select Bulk Data Load Jobs." Does not exist in my PE org and I am logged in as the admin.
Hi

I have created a command Line Dataloader for Upserting record in schedular basic...Its working Propely in schedular basic,but problem is in my .csv file the Date value is 29/10/2015.after upserting using CMD in salesforce org the Date is 9/5/2017,means Date not taking right value..is there any setting or soluton for this....

Thanks in advancs
Hello,

 
trigger triggerTest on Contact (after insert, after update) {
    Set<Id> contactIds = new Set<Id>();
    
    for (Contact obj : Trigger.new) {
        contactIds.add(obj.Id);
    }
    
    contactIds.remove(null);
    System.debug(contactIds);//This line gives me 6 repeated ids for contact, I want to get only one
what is the reason

 
  • November 12, 2015
  • Like
  • 0

Hi,
 
I try to put a user as case owner but when I insert the case I see that the owner is the default case owner configured in the support setting.
To avoid this I tried to bypass assignment rules :
 
            
Case c = new Case();
c.ownerId = myUser.id;
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule= false;
dmo.assignmentRuleHeader.assignmentRuleID = null;
c.setOptions(dmo);
insert(c);

Nevertheless, the default queue case is always owner.
When we create a case outside unit test, it's created with the good user.  

Thanks
 
I have a workflow rule that sums 4 different fields and then updates the Amount field.   I would like to add a validation rule that says the Amount field can't be blank if the Stage is beyond Tracking.   Since the validation rule fires before the workflow rule, it is always sending the Error Message.   I tried to use the OR statement for each of the fields, but it did not work.  Any Ideas?
Hi experts,

When ever the the project type is =' Replacement' it should not allow profiles either creation or updattion child record field called Works_Order_Number__c, it working fine for the creation not on updation. could anyone help me please.

 AND (ISNEW(),

TEXT( Project__r.Type__c ) = 'Replacement',

NOT(ISBLANK(Works_Order_Number__c)),

OR(

$Profile.Name ='Ferns Sub reinstator (UKPN, NG)',

$Profile.Name = 'H&S Administration',

$Profile.Name = 'NGA Commercial',

$Profile.Name = 'NGA Op & MRS Op & PO Approval',

$Profile.Name = 'NGA Operational',

$Profile.Name = 'NGA Sub Reinstator',

$Profile.Name = 'Sub Reinstator (EDF, NG)',

$Profile.Name = 'tRIIO Commercial',

$Profile.Name = 'tRIIO Operational',

$Profile.Name = 'tRIIO Planners/Schedulers',

$Profile.Name = 'tRIIO POS and Company',

$Profile.Name = 'tRIIO POS Only',

$Profile.Name = 'tRIIO Sub Reinstator Admin',

$Profile.Name = 'tRIIO Purchasing',

$Profile.Name = 'System Administrator'

)

)
Hi,
I need to apply styling for pageblocksection.Here is the code

<apex:page standardcontroller="Account" showHeader="true" tabStyle="account">
  <style>
  .activetab {background-color:green color:white background-image:none>
  .inactivetab {background-color:white color:black background-image:none>
  </style>
<apex:form>
  <apex:tabPanel switchtype="client" selectedTab="tabdetails"
id="AccountTabPanel" tabClass="activeTab"
inactiveTabClass="inactiveTab">
<apex:tab label="Details" name="AccDetails" id="tabdetails">
<apex:pageblock>
<apex:pageblocksection title="Account" columns="1">
<apex:inputfield value="{!account.name}"/>
</apex:pageblocksection>
</apex:pageblock>
</apex:tab>
</apex:tabpanel>
</apex:form>
</apex:page>
I need to apply styling for pageblocksection 
Can someone help me

Thanks & Regards,
Sindhu Ambarkar.
Right now, I am using these line of code

Map<String, Schema.SObjectType> all_object = Schema.getGlobalDescribe();
Map<String,Schema.SObjectField> field = all_object.get(rule_type).getDescribe().fields.getMap();


but can't able to show the result on VF page....can anyone help me in this..?
Hi All,

I'm very new in salesforce. So, I have no idea how I can acheive my below requirement in salesforce and need your suggestions.

Problem: I have two objects in my sample application.
Work Item:
  • Work Item ID
  • Work Log Date
  • Description
  • Time Taken
  • Invoice(Master relation to Invoice object)
Invoice:
  • Invoice ID
  • Created Date
  • Is Payment received.
  • Hourly Rate
  • Total Working Hour
  • Total Work Charges
  • Payment Charges
  • Total Amount Due
So, in my invoice tab I have a button which will download an excel report for Invoice and work items related to the particular invoice.

Invoice Tab

Sample Excel report








 
I need to export convertCurrency(Amount) FROM Opportunity, ie converted currency this will come whenever multi currency is enabled,

Please give any suggetions to get the data export from sf 
Hi,

I'm looking for a step by step instructions for integrating Salesforce with external Applications. Can anyone help me with that.

Thanks,
Avantik.
Hi experts,

When ever the the project type is =' Replacement' it should not allow profiles either creation or updattion child record field called Works_Order_Number__c, it working fine for the creation not on updation. could anyone help me please.

 AND (ISNEW(),

TEXT( Project__r.Type__c ) = 'Replacement',

NOT(ISBLANK(Works_Order_Number__c)),

OR(

$Profile.Name ='Ferns Sub reinstator (UKPN, NG)',

$Profile.Name = 'H&S Administration',

$Profile.Name = 'NGA Commercial',

$Profile.Name = 'NGA Op & MRS Op & PO Approval',

$Profile.Name = 'NGA Operational',

$Profile.Name = 'NGA Sub Reinstator',

$Profile.Name = 'Sub Reinstator (EDF, NG)',

$Profile.Name = 'tRIIO Commercial',

$Profile.Name = 'tRIIO Operational',

$Profile.Name = 'tRIIO Planners/Schedulers',

$Profile.Name = 'tRIIO POS and Company',

$Profile.Name = 'tRIIO POS Only',

$Profile.Name = 'tRIIO Sub Reinstator Admin',

$Profile.Name = 'tRIIO Purchasing',

$Profile.Name = 'System Administrator'

)

)
Hi,
I need to apply styling for pageblocksection.Here is the code

<apex:page standardcontroller="Account" showHeader="true" tabStyle="account">
  <style>
  .activetab {background-color:green color:white background-image:none>
  .inactivetab {background-color:white color:black background-image:none>
  </style>
<apex:form>
  <apex:tabPanel switchtype="client" selectedTab="tabdetails"
id="AccountTabPanel" tabClass="activeTab"
inactiveTabClass="inactiveTab">
<apex:tab label="Details" name="AccDetails" id="tabdetails">
<apex:pageblock>
<apex:pageblocksection title="Account" columns="1">
<apex:inputfield value="{!account.name}"/>
</apex:pageblocksection>
</apex:pageblock>
</apex:tab>
</apex:tabpanel>
</apex:form>
</apex:page>
I need to apply styling for pageblocksection 
Can someone help me

Thanks & Regards,
Sindhu Ambarkar.
Right now, I am using these line of code

Map<String, Schema.SObjectType> all_object = Schema.getGlobalDescribe();
Map<String,Schema.SObjectField> field = all_object.get(rule_type).getDescribe().fields.getMap();


but can't able to show the result on VF page....can anyone help me in this..?
Hi All,

I'm very new in salesforce. So, I have no idea how I can acheive my below requirement in salesforce and need your suggestions.

Problem: I have two objects in my sample application.
Work Item:
  • Work Item ID
  • Work Log Date
  • Description
  • Time Taken
  • Invoice(Master relation to Invoice object)
Invoice:
  • Invoice ID
  • Created Date
  • Is Payment received.
  • Hourly Rate
  • Total Working Hour
  • Total Work Charges
  • Payment Charges
  • Total Amount Due
So, in my invoice tab I have a button which will download an excel report for Invoice and work items related to the particular invoice.

Invoice Tab

Sample Excel report








 
Hello,
 
https://servicesgateway.com/{version}/rest/{service}
 <ConfigElement name="cAccount" Url="https://servicesgateway.com/1/rest/searchByName" ContractID="XXXX" UserPrefix="XXXXXXX" UserID="XXXXX" Password="XXXXX" AppID="XXX" Version="1" />

I have a above link, which is link for web service.

I want to get the data from this link.

What are steps to do so using REST 

Thanks
  • October 13, 2015
  • Like
  • 1
Hello,

I am looking for a tutorial to integrate a wed service using rest method.

I have webservice which sends XML request and get XML response.
I am looking for tutorial to integrate a simple exsisitng web service, later i will modify for me.

thanks
  • October 13, 2015
  • Like
  • 1

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.