• Raghu Nani
  • NEWBIE
  • 193 Points
  • Member since 2016
  • Senior Developer


  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 30
    Questions
  • 93
    Replies
global class OTFAutomationReport implements Database.Batchable<sObject> {
    global Database.QueryLocator start(Database.BatchableContext bc)
    {
        //String query = 'select Id,OTF_Total_Hours__c,OTFClient__c, OTF_Date__c, (select Date__c, Duration_Hours__c from Time_Logs__r) from account where Name='+80 Acres Farms+';
       
        
        system.debug('==query==>' +[select Id,OTF_Total_Hours__c,OTFClient__c, OTF_Date__c, (select Date__c, Duration_Hours__c from Time_Logs__r) from account where Name='80 Acres Farms']);
        return Database.getQueryLocator([select Id,OTF_Total_Hours__c,OTFClient__c, OTF_Date__c, (select Date__c, Duration_Hours__c from Time_Logs__r) from account where Name='80 Acres Farms']);
       
    }
    global void execute(Database.BatchableContext bc, List<account> scope)
    {
        system.debug('==scope==>' +scope);
        //decimal TotalHours=0.0;
        list<account> accUpdate = new list<account>();
        for(account a: scope)
           
        {
            a.OTF_Total_Hours__c=0.0;
            system.debug('a===>1st loop' +a);
            for(Time_Log__c tl : a.Time_Logs__r)
            { system.debug('a===>2nd loop' +tl);
            
                //system.debug('a==a.OTF_Total_Hours__c=>2nd loop' +a.OTF_Total_Hours__c);
             system.debug('a=tl.Duration_Hours__c==>2nd loop' +tl.Duration_Hours__c);
            
                if(tl.Duration_Hours__c!=NUll && a.OTF_Total_Hours__c!=Null){
                a.OTF_Total_Hours__c +=tl.Duration_Hours__c;
                system.debug('==TotalHours==>' +a.OTF_Total_Hours__c);
                if(a.OTF_Total_Hours__c>=20 && a.OTFClient__c==false)
                {
                    a.OTFClient__c=true;
                    system.debug('==a.OTFClient__c==>' +a.OTFClient__c);
                    a.OTF_Date__c=tl.Date__c;
                    accUpdate.add(a);
                }
                }
            }
           
            
        }
        system.debug('==accUpdate > ' +accUpdate);
        update accUpdate;
       
    }
    global void finish(Database.BatchableContext BC)
    {}   
    
}
 
public class test5 {

  public list<string> lststatename{get;set;}
  public list<string> lstrating{get;set;}

 public test5(){
 
 
    string  jsonexample1 =  ' { "overalldata": [ {"stateName": "Andrapradesh",  "rating": 5.0 }, { "stateName": "Telangana",  "rating": 4.0 }, {"stateName": "Banglore",  "rating": 5.0 } , {"stateName": "Maharastra",  "rating": 4.5 }  ] } ';

   
     map<string,object>  metadatamap= (map<string,object>)json.deserializeuntyped(jsonexample1); 
     
      list<object>  values1= (list<object>)metadatamap.get('overalldata');
        
        
         lststatename= new list<string>();
         lstrating= new list<string>();
         
          for(object parsed : values1){
             
             
           map<string,object>  values = (map<string,object>)parsed;
             
             
            string statename = string.valueof(values.get('stateName'));
             string rating= string.valueof(values.get('rating'));
               
             lststatename.add(statename );
             lstrating.add(rating);
            
             }
       
 }
}
 
<apex:page controller="test5" >

 <apex:form >
 
 <table>
  <tr>
    <th>states</th>
    <th>rating</th>
  </tr>
  
  <apex:repeat value="{!lststatename}" var="a">
  <apex:repeat value="{!lstrating}" var="b">
  <tr>
   
   <td>{!a}</td>
  
    
    <td>{!b}</td>
  </tr>
   </apex:repeat>
   </apex:repeat>
</table>
    
 
 </apex:form>
 
</apex:page>

User-added image
 here to use the html table to display the values, but the data is getting iterated again , Any body have any idea to handle this. thanks in advance .. 

Additionally, if you update or delete a record in its before trigger, or delete a record in its after trigger, you will receive a runtime error. This includes both direct and indirect operations. For example, if you update account A, and the before update trigger of account A inserts contact B, and the after insert trigger of contact B queries for account A and updates it using the DML update statement or database method, then you are indirectly updating account A in its before trigger, and you will receive a runtime error.

can some one help me understan with an example pls
Hello, All.

I am trying to get information about users including IsActive and IsFrozen. IsActive is on the User object while IsFrozen is on the UserLogin object. The UserLogin object contains a User lookup field with an API name of UserId, (According to this documentation page: https://developer.salesforce.com/docs/atlas.en-us.sfFieldRef.meta/sfFieldRef/salesforce_field_reference_UserLogin.htm)

Queries to the UserLogin work fine:
/services/data/v45.0/query/?q=select+Id,IsFrozen,UserId+from+UserLogin

Queries to the User work fine:
/services/data/v45.0/query/?q=select+Id,IsActive+from+User

But combining the two into one query fails:
/services/data/v45.0/query/?q=select+Id,IsFrozen,UserId,UserId.IsActive+from+UserLogin

I am modeling my combined query after the another cross-object query that I have verified is working correctly:
/services/data/v45.0/query/?q=select+Id,Account.Name+from+Contact

What am I doing wrong here?



 
I am working on apex class which will fetch details from Campaign Member object, once it is fetched I am looking at map size, if it is greater than zero then I am creating a record in Staging_Event_Attendee__c object.
in Campaign Member if ContactId field is not null then I am populating Staging_Event_Attendee__c.Attendant = ContactId, now same like that if LeadId is not null then I need to populate Staging_Event_Attendee__c.Lead__c = LeadId
Can anyone help me out in this issue, on Campaign Member record I can have either leadId or ContactId at time.
I need to have a condition to check whether LeadId or ContactId is not null, if leadId is not null then I need to create a new record where Staging_Event_Attendee__c.Lead__c = CampaignMap.get(Con.Barcode__c).LeadId If ContactId is not null then I need to create a new record where Staging_Event_Attendee__c.Lead__c = CampaignMap.get(Con.Barcode__c).ContactId
 
Map<Id,CampaignMember> CampaignMap = new Map<Id,CampaignMember>([select ContactId,CampaignId from CampaignMember where Id in: barcodeSet]);
        for(Staging_Event_Attendee__c con : stagingEventAttendeeList) {
            if(CampaignMap.size()>0 ){
            con.Attendant__c = CampaignMap.get(con.Barcode__c).ContactId;
            con.Campaign_ID__c = CampaignMap.get(con.Barcode__c).CampaignId;
            con.Date_Attended__c = system.now();
        }
            else{
                con.Invalid_Barcode__c = true;
                con.Date_Attended__c = system.now();
            }
        }

 
Hello everyone,
As everyone know, in community we have standard navigation in Header, unlikey we can add new Tabs here, but tab will always display only name not images. I have requirement to show Image & name in tab. I tried to create custom navigation to replace with existing one. but i didnt find any. please share if any thoughts.

User-added image
Hi Team,

I have a community where we have to track community visits, as per this document, we have out-of-box feature can used.

https://help.salesforce.com/articleView?id=networks_reporting.htm&type=0

I Created the report for Network Public Usage Daily Metrics, but no records in that recport. I am confused why community visits are not logging here.
Hi Team,

I have little confusion. We all know about different languages in Salesforce.

I know  about Language settings & Translation Workbench where we enable the languages in salesforce. 

and In salesforce we have Default,end-user and platform-only languages.

I am confused about Multilingual Communities, how many languages available in Communities?
we have public site where images are loading from attachment
<img id="theImage" src="{!URLFOR($Action.Attachment.Download, attachment.id)}"/>
this will work only guest user has VIEWALL access to relevant Object(ObjectName: Logo)associated with Attachment
I want to achieve this functionality without VIEWALL access only by granting read access because in winter21 salesforce removing the VIEWALL access to guest user.

I verified the  owd LOGO Object is Public Read/Write for Internal & External access.
I verified there is no Parent object on LOGO object.
I verified, Attachment Id is appearing in VF page but logo is not displaying

Any Idea how to fix.
URL Redirect
Is there any wildcard or way to setup so it doesn't do an exact match.
 
I want to do a redirect anytime it hits a relative url like /detail/foo ... however if it has a querystring it ignores it  so this does nothing 
/detail/foo?id=xxxxxxxxxxxxxxxx
 
Tried a variety of different formats but no luck.  Not sure it is possible.
 
I need system to ignore parameters and if it matches /detail/foo it has to redirect, but not happening
Thanks
Hi Team,

I am facing issue, unable to retrieve the process builder using Salesforce CLI in VS Code. Please let me know, if anyone know exact steps how to retrieve.

Actually i tried before and after version 44 because some changes are released in version 44. But results in my local system..
Hi Team,

In my org omnichannel set up is done and every time client to trying to connect the omnichanne chat, i would like to display the average wait time for responce. Please suggest how to proceed on this.

Regards,
Raghu
is this possible to change the Price book in Quote object. I am unable to change, can any one please assist on this
Hi All,
I am getting below error while creating the Community User
Error: First exception on row 0; first error: UNKNOWN_EXCEPTION, portal account owner must have a role.

I verified the Account owner Role. It was selected the role also.

Later i found that Account Owner is inactive.

In this senario how to create community user. Is i need to change Account Owner? Please confirm or any best solution.
Hi,
scenario is I created a button ,
on click of button I need to open VF page along with parameters
if I hard code url in button for community users not working
bcz of  community name in not there URL
is this any way to form URL dynamically

I tried URLFOR in Formula
{!URLFOR($Page.ProcurementDetailsPage, null, [Id=SomeId])}
I am getting Error Page.ProcurementDetailsPage does not Exist
Can any one help on this


Thanks,
raghu
Hi friends,

Usually after Update trigger will gives the error saying maximum Trigger depth Exceeded.
How many times trigger will execute to reach this error Or in other words What is the depth of the trigger?



Thanks,
Raghu
Hi friends,

Can any one please conform is this possible in Salesforce Classic .
Requirement: is this Possible to get the SUB Tabs under Primary Tabs (because in my application too many tabs are there so for look and feel is this possible to set some tabs under Primary tabs)


Thanks,
Raghu
Hi friends,
I want to add meeting request in visualforce page can any one suggest the how to do, Or
suggest any app exchange app to suitable for meeting requests in salesforce
Hi Friends,
My client need a Meeting request and Schedular in Visualforce page is this any way to add that standard functionality using apex and VF 
OR can u please suggest any cloud schedulars,calenders which will do the same functionality..


Thanks
Raghu
HI friend,

I know normal standard user we can create from visualforce page also, but my requirement is to create Community and Community plus users need to create through VF page, i know usually we will create Community users from CONTACT , but i dont know is this any way to create community users through VF . this is bit urgent .

Thanks,
Raghu
What is the latest release for salesforce, and any one tel me when will be the next release
How to add Home Calender Section in Visualforce Page ,
If  calender not possible, Pls suggest How to do New Meeting Request from Visualforce page and along with i need to display( Scheduled Meetings & Requested Meetings ) in Visualforce Page

Pls Help me ASAP
Thanks 
Raghu
           <apex:repeat value="{!FormList}" var="f">
                        <apex:variable var="count" value="{!0}" />
                             <apex:repeat value="{!f.categories}" var="c">
                                 <apex:repeat value="{!c.tasks__r}" var="t" >
                                     <tr>
                                              <td>{!t.Task_Name__c}</td>
                                              <td><apex:inputField value="{!f.siteSelectionChilds[count].LQ_Owner_Responsible__c}"  /></td>
                                              <td><apex:inputField value="{!f.siteSelectionChilds[count].LQ_Date_Completed__c}"  /></td>
                                              <td><apex:inputField value="{!f.siteSelectionChilds[count].LQ_Comments__c}"/></td>
                                    <apex:variable var="count" value="{!count+1}" />
                                    </tr>
                                 </apex:repeat>
                             </apex:repeat>
                    </apex:repeat>
                              

hi above is my code in loop i am trying to insert the siteSelectionChilds data but i am unable to get the entered values to my apex class pls suggest any one
Hi friends the below code is VFpage code , I was created Homepage VF component and added in home Layout , but it is not redirecting to that specific link i dont know why, can any one help on yhis ... ASAP,actually the Href link is report link

<apex:page >
<script>
location.href="https://cs31.salesforce.com/00Op0000000GwfT";
 </script>
</apex:page>
Hi fiends,
               My requirement is simple, can any one help on this ...
     Requirement is i was created a Custom report ,when ever user logs into system by default we need to render that report,
 i thought it is possible by writing vf page and redirect to specific link but i coudnt ,cal any one help on this with code
I wanted to understand that if i am calling an apex webservice method on a javascript button click via execute method like below as a sample

var result= sforce.apex.execute("methodname","param",{Id:Id});
document.location.reload();

so is the sforce.apex.execute method work as async or sync? will the document.location.reload() have to wait untill i get a response from my apex method or it will refresh my page.

My problem is i really want to execute it async and just make a call to the apex method where i am handling all the stuff via platform events and on front end just want to reload the page. but currently it seems like it blocks the page reload untill all functionality at the backend complete and than proceed. 

Any help in this regard will be appreciated.
Hello everyone,
As everyone know, in community we have standard navigation in Header, unlikey we can add new Tabs here, but tab will always display only name not images. I have requirement to show Image & name in tab. I tried to create custom navigation to replace with existing one. but i didnt find any. please share if any thoughts.

User-added image
Hi Team,

I have a community where we have to track community visits, as per this document, we have out-of-box feature can used.

https://help.salesforce.com/articleView?id=networks_reporting.htm&type=0

I Created the report for Network Public Usage Daily Metrics, but no records in that recport. I am confused why community visits are not logging here.
URL Redirect
Is there any wildcard or way to setup so it doesn't do an exact match.
 
I want to do a redirect anytime it hits a relative url like /detail/foo ... however if it has a querystring it ignores it  so this does nothing 
/detail/foo?id=xxxxxxxxxxxxxxxx
 
Tried a variety of different formats but no luck.  Not sure it is possible.
 
I need system to ignore parameters and if it matches /detail/foo it has to redirect, but not happening
Thanks
Hi Team,

In my org omnichannel set up is done and every time client to trying to connect the omnichanne chat, i would like to display the average wait time for responce. Please suggest how to proceed on this.

Regards,
Raghu
Hi Everyone,

I'm using @wire to pull back a fields value and then trying to pass it in an http callout. Unfortunately, the value is coming back undefined in the debugger and I used the salesforce documentation exactly. Does anyone see what I'm missing?
import { LightningElement, track, api, wire } from 'lwc';//api, wire 

import { getRecord, getFieldValue } from 'lightning/uiRecordApi';

//import field reference from schema
import SERIAL_FIELD from '@salesforce/schema/Asset.Serial_Test__c';

const field = [SERIAL_FIELD];

export default class TestCallout extends LightningElement {
  
    @track toDoData;
    @api recordId;
    @wire(getRecord, { recordId: '$recordId', field})
    asset;
   
    //return serial number field value
    get serial() {
        return getFieldValue(this.asset.data, SERIAL_FIELD);

    }

    //make callout using fetch
    connectedCallback() {

        fetch('https://jsonplaceholder.typicode.com/todos?id'+ this.serial, 
        //endpoint passes serial number from current sfdc record
        {
            // Request type
            method:"GET",
        
            headers:{
                // content type
                "Content-Type": "application/json",
                // adding your access token 
                //"Authorization": 'Basic ' + btoa(username + ":" + password),
                //"Authorization": "OAuth 00DB0000000EfVQ!AQwAQEiiynMU2EsBcS2PhXSQ6KQTTG.Zr0hlDHTFcGcAPqKQOBNDB0rwyASZK44fqIAVe6GrVNZPsAWJ6iqXLNBfSQ.dqvW1",
            }
        })
        .then((response) => {    
            return response.json(); // returning the response in the form of JSON
        })
        .then((jsonResponse) => {
                
                        let objData = {
                            title : '',
                            completed : '',
                        };
                        window.console.log('jsonResponse ===> '+JSON.stringify(jsonResponse));
                        // retriving the response data
                        let jsonData = jsonResponse[0];
            
                        // adding data object
                        objData.title = jsonData.title; 
                        objData.completed = jsonData.completed;
            
                        // adding data object to show in UI
                        this.toDoData = objData;
                    })
                    .catch(error => {
                        window.console.log('callout error ===> '+JSON.stringify(error));
                    })
                } 
            
            }

 

Hi,

When you add a query string to a page, it loads as expected. However, when you add a query string to an address that is either a 301 redirect or an alias in Site.com, the page does not load. The examples below:

Normal Page:
Without Query String - http://www.example.com/test-folder/test-page (works)
With Query String - http://www.example/test-folder/test-page?mkto=abc (works)

301 Redirect:
Without Query String - http://www.example.com/test-folder/test-redirect (works)
With Query String - http://www.example.com/test-folder/test-redirect?mkto=abc (fails)

Alias:
Without Query String - http://www.example.com/test-folder/test-alias (works)
With Query String - http://www.example.com/test-folder/test-alias?mkto=abc (fails)

 

- Anthony