• Vineela Proddaturu
  • NEWBIE
  • 39 Points
  • Member since 2022

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 17
    Replies
I am trying to built a VF page. I wrote tags for labels and their input box but i was able to create only Labels not along with their Input Box. here is my VF Tags

<apex:page standardController="contact">
 <apex:form>
    <apex:sectionHeader title="Contact" subtitle="New Contact"/>
    <p> Contacts not associated with accounts are private and cannot be viewed by other  users or included in reports.</p>
    <apex:pageblock title="Contact Edit" Tabstyle="Contact">
   <apex:pageblocksection title="Contact Information"     columns="1" Collapsible="True">
    
       <apex:pageBlockSectionItem>
        <apex:outputLabel value="First Name"/>
        <apex.inputText value="{!Contact.FirstName}"/>
      </apex:pageBlockSectionItem>
       
       <apex:pageBlockSectionItem>
       <apex:outputlabel value="Last Name"/>
       <apex.inputText value="{!Contact.LastName}"/>
    </apex:pageBlockSectionItem>
       
        <apex:pageBlockSectionItem>
            <apex:outputlabel value="BirthDate"/>
            <apex.inputText value="{Contact.birthdate}"/>
    </apex:pageBlockSectionItem>
    </apex:pageblocksection>
                                                                       
    </apex:pageblock>
    </apex:form>
</apex:page>      
Hello,
 Write a trigger such that we have two objects Account and Contact. Field named numberofcontacts on Account. If we insert number of contacts as 3, then three contacts should be created.
Best Regards 
Hi All, how can I get deleted date of a record from Recycle bin using SQL in apex?
Want Validation rule that only record owner or System Administrator can CREATE related record. eg if person_1 creates a record only person_1  should be able to create its related records.
Hi,
I have a scheduler class which reads list of objects (object1, object2, object3) and invokes batch class for each object.
Batchclass bc = new Batchclass(object1)
batchJobId= database.executeBatch(bc,1000);

I would like to delay the batch job execution if object is 'Contact' . CAn you please share how it needs to be done ?
Hello All

   I am new salesforce admin/developer. I have a requirement to create a new field(# of Active policy) in Account object which calculate the total no of active policy associated in the account. Whenever a new policy is added or expired, the new field(# of Active policy) in account object  is calculated. I am calculating this in Policy Trigger hander class. It is working fine whenever the policy status is changed or added. Now i need to calculate this field value for all the accounts with existing policy. What is the best way to achieve this?  Dataloader to update field in Policy object ? or Flow builder?

Please suggest ideas.

Thanks
Ramya Balakrishnan
I am getting the below error when I am doing bulk update.
List has more than 1 row for assignment to SObject

on this line of my code - 
Account acc = [SELECT Email__c FROM Account WHERE Id IN (SELECT AccountId from Opportunity WHERE Id =:Ids)];

My Apex class -

@InvocableMethod
    public static void calculate(List<Id> Ids){
        System.debug('--Id : '+Ids);
            if(!System.isFuture()) {
                CallculateCalloutAsync(Ids);
        }
    } 
    @future(callout=true)
    public static void CallculateCalloutAsync(List<Id> Ids){
        Account acc = [SELECT Email__c FROM Account WHERE Id IN (SELECT AccountId from Opportunity WHERE Id =:Ids)];
        HTTP http = new HTTP();
        HTTPRequest request = new HTTPRequest();
        List<Amount__c> listCS      =       Amount__c.getall().values();   
        if (listCS != null && listCS.size() > 0) {
            String endp                     =       listCS[0].endpoint__c+acc.Email__c;
            String auth                     =       listCS[0].auth__c;
            String authorizationHeader      =       'Basic '+ auth;
            
            request.setHeader      ('Authorization', authorizationHeader);
            request.setEndpoint    (endp);
            request.setMethod      ('GET');
            request.setHeader      ('Content-Type', 'application/json; charset=utf-8');
            HTTPResponse response = http.send(request);
            system.debug('--response : '+response.getBody());
            
            if(response.getStatusCode() == 200){
                system.debug('The Response Body: '+response.getBody());
                Map<String, Object> deserializedPayload = (Map<String, Object>)JSON.deserializeUntyped(response.getBody());
                Decimal balance = (Decimal)deserializedPayload.get('tax');
                Opportunity opp = new Opportunity(Id = Ids[0]);
                opp.amount__c = tax;
                update opp;
            } 
            if(response.getStatusCode() != 200){
                System.debug('The Response Body: '+response.getBody());
                System.debug('No data found!');
            }
 
  • September 26, 2022
  • Like
  • 0
Konse step ke baad lihknaa chaiye vo answer dekhne k liye 
if account  billing address is update then related contact mailingaddress is also update???

Create a Trigger on the Account Object, to make sure each Account Record should have "Rating, Phone and Fax Field values".

   

    Object Name : Account Object.

    Event Name  : Before Insert.

   

    trigger AccountsTrigger on Account (before insert) 

    {

        if(Trigger.isInsert && Trigger.isBefore)

        {

            for(Account accRecord : Trigger.New)

            {

                if(accRecord.Rating == Null || accRecord.Rating == '')

                    accRecord.Rating.AddError('Please Select the Rating Value.');

                else if(accRecord.Phone == Null || accRecord.Phone == '')

                    accRecord.Phone.AddError('Please Enter the Contact Number.');

                else if(accRecord.Fax == Null || accRecord.Fax == '')

                    accRecord.Fax.AddError('Please Enter the Fax Number.');

            }

        }

    }

   

I am trying to built a VF page. I wrote tags for labels and their input box but i was able to create only Labels not along with their Input Box. here is my VF Tags

<apex:page standardController="contact">
 <apex:form>
    <apex:sectionHeader title="Contact" subtitle="New Contact"/>
    <p> Contacts not associated with accounts are private and cannot be viewed by other  users or included in reports.</p>
    <apex:pageblock title="Contact Edit" Tabstyle="Contact">
   <apex:pageblocksection title="Contact Information"     columns="1" Collapsible="True">
    
       <apex:pageBlockSectionItem>
        <apex:outputLabel value="First Name"/>
        <apex.inputText value="{!Contact.FirstName}"/>
      </apex:pageBlockSectionItem>
       
       <apex:pageBlockSectionItem>
       <apex:outputlabel value="Last Name"/>
       <apex.inputText value="{!Contact.LastName}"/>
    </apex:pageBlockSectionItem>
       
        <apex:pageBlockSectionItem>
            <apex:outputlabel value="BirthDate"/>
            <apex.inputText value="{Contact.birthdate}"/>
    </apex:pageBlockSectionItem>
    </apex:pageblocksection>
                                                                       
    </apex:pageblock>
    </apex:form>
</apex:page>      

Hi Can I have many phone fields in one validation rule? For example, phone, work, mobile and emergency contact. I am using this formula. So my question is can I add more fields to this formula and if so, HOW? I have tried different things and no luck. 


AND(
OR(
ISNEW(),
ISCHANGED(Phone)
),
NOT(ISBLANK(Phone)),
NOT(REGEX(Phone, "\\D?(\\d{3})\\D?\\D?(\\d{3})\\D?(\\d{4})$"))
)

  • April 12, 2022
  • Like
  • 0