• Karthik Mano
  • NEWBIE
  • 20 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 7
    Replies
I couldn't find this documentation anywhere. I'm sure that all the batch apex jobs gets queued up in the Apex Flex Queue which now has a LIMIT of 100. Does queueable apex jobs go to Apex Flex Queue as well which will also come under this 100 LIMIT? 

Thanks
Karthik
Hi, Would i be able to capture the raw XML request i recieve in Salesforce before the webservice method is invoked so i'll be able to log all my actual incoming requests for the purpose of maintaining the request logs?
Hi,

I am inserting new User in After insert and updating existing Users in before Update trigger on Contact. But it doesn't throw me the Mixed DML Operation between setup and non setup objects.

I am doubting if this is any bug in Salesforce or is this the expected function? Because i have previously gone for @Future methods when doing these kind of DMLs. But it doesn't throw me any exception in this case on trigger and the Contact as well as User DMLs are successful.

Any view on this will be helpful. Thanks.
Hi,

I have a requirement where the User dynamically selects a field from the dropdown(VF select Option) and i have to check whether those field values are available in a map or not.

I have a Select Option in Vf where all the "Account" fields will be available. The selected field's API name will be set in a get set "selectedField"

public String selectedField{get;set;} // This is the String where the API name of selected field will get set

and here is my code,

List<Account> accList = new List<Account>([SELECT Id,NumberofLocations__c FROM Account WHERE NumberofLocations__c != NULL]);

Map<String,Account> accMap = new Map<String,Account>(); 

for(Account acc:accList) {
    accMap.get(acc.selectedField); // Here is the problem, I need to get the value from the map based on the field selected by the user. I get an error                                                                 selectedField does not exist in Account object.
}

I tried an alternative,

for(Account acc:accList) {
     String val = 'acc.'+selectedField;
    accMap.get(val);   // No success with this approach too. 
}


Suggestions please ??

Hi ,

 

I am trynig to create a vf for Account Team "Add" button. my code is like following ,

 

<tr>
<td><apex:inputField value="{!AccountTeamMember.UserId}" required="false" /></td>
<td><apex:inputField value="{!AccountTeamMember.TeamMemberRole}"/></td>
<td><apex:inputField value="{!AccountTeamMember.AccountAccessLevel}"/></td>
</tr>
<tr>
<td><apex:inputField value="{!AccountTeamMember.UserId}" required="false" /></td>
<td><apex:inputField value="{!AccountTeamMember.TeamMemberRole}"/></td>
<td><apex:inputField value="{!AccountTeamMember.AccountAccessLevel}"/></td>
</tr>

 

Where i am creating two members at a time. Can any one please let me know how to get these two UserIds in controller. **AccountTeamMember.UserId is the standard User LookUp field i have used.

 

Thanks Much.

Hi . In my vf page i am getting an error like  " Unknown property 'SObject.name' "

Controller :

List<Account> accList=new List<Account>([SELECT Name,ID,owner.name FROM Account]);

public List<objectwrapper> getavailableObjects() {

if(selected_object=='ACCOUNT') {
for(Account a:accList) {
wrapperList.add(new objectwrapper(a));
SelectObject();
}
}
return wrapperList;
}

public class objectwrapper  {
public sObject Objectwrap{get;set;}
public boolean selected {get;set;}
public objectwrapper(sObject sob)
{
Objectwrap=sob;
selected=false;
}

}

vf page :

<apex:pageBlockTable value="{!availableObjects}" var="obj">

<apex:column >
<apex:inputCheckbox value="{!obj.selected}" id="checkeddone">
<apex:actionSupport event="onclick" action="{!GetSelected}" reRender="Sel_OBJ"/>

</apex:inputCheckbox></apex:column>

<apex:column headerValue="Name" value="{!obj.Objectwrap.name}"/>
<apex:column headerValue="ID" value="{!obj.Objectwrap.Id}"/>
<apex:column headerValue="Owner" value="{!obj.Objectwrap.Owner.name}"/>
</apex:pageBlockTable>
</apex:pageBlock>

 
Can anyone please help. I am struck up with this. Thanks in advance !!

Hi , I am using a single controller for 2 vf pages .What i am doing is the user will enter values in first page and once they click search , only the matching trains will be available in the data table with check box in another page.

The problem is the values aren't getting set in the instance pass. **  getting null values in pass.from__c , pass.to__c and pass.Journey_Date__c in the if loop of controller. Please help !

 

1st page :

<apex:page standardController="Train_Details__c" extensions="RailwayReserveNew">
 <apex:sectionHeader title="Passenger Details Edit" subtitle="New Passenger Details"/>
 <apex:form >
 <apex:pageBlock title="Passenger Details Edit">
 <apex:pageBlockSection columns="1" >   
 <apex:inputField value="{!pass.Booker_Name__c}"  />
 <apex:inputField value="{!pass.Total_Senior_Citizens__c}"  />
<apex:inputField value="{!pass.Total_Children_Age_below_6__c}"  />
<apex:inputField value="{!pass.Total_Passengers__c}"  />
<apex:inputField value="{!pass.From__c}"  />
<apex:inputField value="{!pass.To__c}"  />
<apex:inputField value="{!pass.Journey_Date__c}"  />
<apex:inputField value="{!pass.Fare__c}"  />

</apex:pageBlockSection>
<apex:pageBlockButtons >
 <apex:commandButton value="search" action="{!dosearch}"/>
 <apex:commandButton value="save" action="{!save}"/>
 </apex:pageBlockButtons>
  </apex:pageBlock>
  </apex:form>
</apex:page>

Controller :

 

public  class RailwayReserveNew {

List<trainwrapper> wrapperList=new List<trainwrapper>();
List<Passenger_Details__c> passList=new List<Passenger_Details__c>([SELECT From__c,To__c,Journey_Date__c FROM Passenger_Details__c]);
List<Train_Details__c> selectedTrains=new List<Train_Details__c>();
List<Train_Details__c> trainDetails=new List<Train_Details__c>([select Name,Starting_Point__c,Destination__c,EveryDay__c,Monday__c,Tuesday__c,Wednesday__c,Thursday__c,Friday__c,Saturday__c,Sunday__c FROM Train_Details__c]);
private final Train_Details__c acct;


public Passenger_Details__c pass{
get;
private set;}


public RailwayReserveNew(ApexPages.StandardController stdController) {
        this.acct = (Train_Details__c)stdController.getRecord();
            Passenger_Details__c pass=new Passenger_Details__c();

            }

 public  List<trainwrapper> getavailabletrains() {


for(Train_Details__c t: trainDetails) {

if(t.Starting_Point__c==pass.from__c && t.Destination__c==pass.to__c) {

if(t.EveryDay__c==true) {

 

wrapperList.add(new trainwrapper(t));
}

 

else if(t.EveryDay__c==false) {

String journeyDay = Datetime.newInstance(pass.Journey_Date__c, Time.newInstance(0, 0, 0, 0)).format('E').substring(0, 2);
system.debug('**************************' + journeyDay);

if(journeyDay=='Mo' && t.Monday__c==true) {
system.debug('**************************' + journeyDay);
wrapperList.add(new trainwrapper(t));
}
if(journeyDay=='Tu' && t.Tuesday__c==true) {
wrapperList.add(new trainwrapper(t));
}
if(journeyDay=='We' && t.Wednesday__c==true) {
wrapperList.add(new trainwrapper(t));
}
if(journeyDay=='Th' && t.Thursday__c==true) {
wrapperList.add(new trainwrapper(t));
}
if(journeyDay=='Fr' && t.Friday__c==true) {
wrapperList.add(new trainwrapper(t));
}
if(journeyDay=='Sa' && t.Saturday__c==true) {
wrapperList.add(new trainwrapper(t));
}
if(journeyDay=='Su' && t.Sunday__c==true) {
wrapperList.add(new trainwrapper(t));
}

}
}

}
return wrapperList;

}

public pagereference GetSelected() {
selectedTrains.clear();
for(trainwrapper trainwrapper:wrapperList)
if(trainwrapper.selected==true) {
selectedTrains.add(trainwrapper.trainwrap);
}
return null;

}

public List<Train_Details__c> GetSelectedTrains()
    {
        if(selectedTrains.size()>0)
        return selectedTrains;
        else
        return null;
    }

 

 

public class trainwrapper  {

public Train_Details__c trainwrap{get;set;}
public boolean selected {get;set;}

public trainwrapper(Train_Details__c tr)
{

trainwrap=tr;
selected=false;
}

}

public pagereference dosearch(){
return page.railwayreserve;
}

public pagereference save() {
upsert (pass);
return null;
}

}

2nd page :

 <apex:page standardController="Train_Details__c" extensions="RailwayReserveNew">

<apex:form >
<apex:pageBlock title="Available Trains"> 
<apex:dataTable value="{!availabletrains}" var="trains" columns="3" border="2" cellpadding="2">

<apex:column >
<apex:inputCheckbox value="{!trains.selected}" id="checkedone">
<apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_Train"/>
</apex:inputCheckbox></apex:column>

<apex:column headerValue="Name" value="{!trains.trainwrap.Name}"/>
<apex:column headerValue="From" value="{!trains.trainwrap.Starting_Point__c}"/>
<apex:column headerValue="To" value="{!trains.trainwrap.Destination__c}"/>

</apex:dataTable>


<apex:pageBlock Title="Selected Train" id="Selected_Train">
<apex:dataTable value="{!SelectedTrains}" var="s" columnswidth="50px,50px" cellpadding="4" border="1">
<apex:column headervalue="Name" value="{!s.Name}" />
<apex:column headervalue="From" value="{!s.Starting_Point__c}" />
<apex:column headervalue="To" value="{!s.Destination__c}" />
</apex:dataTable>
</apex:pageBlock>

 


</apex:pageBlock>

</apex:form>
</apex:page>

I couldn't find this documentation anywhere. I'm sure that all the batch apex jobs gets queued up in the Apex Flex Queue which now has a LIMIT of 100. Does queueable apex jobs go to Apex Flex Queue as well which will also come under this 100 LIMIT? 

Thanks
Karthik
I'm trying to do the "Work with Schema Builder" trailhead and it says to search for Schema Builder in the Quick Find box in Setup but nothing shows when I type it. 
Hi,

I am inserting new User in After insert and updating existing Users in before Update trigger on Contact. But it doesn't throw me the Mixed DML Operation between setup and non setup objects.

I am doubting if this is any bug in Salesforce or is this the expected function? Because i have previously gone for @Future methods when doing these kind of DMLs. But it doesn't throw me any exception in this case on trigger and the Contact as well as User DMLs are successful.

Any view on this will be helpful. Thanks.
Hi, 

  I need to get all the user role and sub roles within sub role that are associated to a parent role using soql query. Below is the code which i am using to get role and sub-roles data. 

 /* Here I pass user name get the userrole id */
 user gurs = [Select UserRoleId,Email,ForecastEnabled 
                     from user where id = :runningUserId LIMIT 1];

/*  Here I pass the userrole id to see parentroleid */
 List<User> UsrList = [Select FirstName, Id, LastName, UserRoleId, UserRole.Name 
                            from User 
                            Where UserRole.ParentRoleId = :gurs.UserRoleId];

I am able to see below roles when i run the above soql code. 

 Example : 
     EMEA - Level - 1
          EMEA- Sub Level -2 

My new requirement is 

 Example 
     EMEA - Level - 1
          EMEA- Sub Level -2 
              EMEA - Super Sub Level-3

If I pass user name I should be able to see all the 3 level hierarchy data if there are ever 4 I should be able to see all the 4 level 

Please suggest me apex experts how i can achive this requirement need you suggestion 

Thanks
Sudhir
I am using Apex REST to call Amazon S3.  I am trying to get the list of the content of a specific folder in a bucket.  The GET request returns all the content of the bucket but I would like to get just the content of a specific bucket.  I think I need to pass a Delimiter and/or a Prefix but not sure how to do this.  I tried this below but doesn't seem to have any effect.
     
       req.setHeader('Prefix','VHUB/INBOX/') ;       
       req.setHeader('Delimiter','/');                        
 
public AWS_Keys__c awsKeySet;
public String bucketname1 = BUCKETNAME; 
public String key1=KEY;
public String secret1=SECRET;
          
// public void readGetFromVirtualS3(){   
         //this is needed for the PUT operation and the generation of the signature.  I use my local time zone.        
        String formattedDateString1 = Datetime.now().format('EEE, dd MMM yyyy HH:mm:ss z','America/Los_Angeles');   
        
        String method1 = 'GET';
        HttpRequest req = new HttpRequest();
        Http http = new Http();
        String filename1 =''; //'500/' ; 
        //String filename = 'VHUB/INBOX/' ;

        req.setEndpoint('https://'+ bucketname1 +'.s3.amazonaws.com' +'/'+ filename1);   
     /********   req.setHeader('Prefix','VHUB/INBOX/') ;		********/
   /********	req.setHeader('Content-Type', ''); 			
  	 		req.setHeader('Delimiter','/');				********/

        req.setMethod(method1);
        req.setHeader('Date', formattedDateString1);
        req.setHeader('Authorization',createAuthHeader(method1,filename1,formattedDateString1,bucketname1,key1,secret1));
         //Execute web service call
            try {
                HTTPResponse res = http.send(req);
                System.debug('MYDEBUG: ' + ' RESPONSE STRING: ' + res.toString());
                System.debug('MYDEBUG: ' + ' RESPONSE STATUS: '+ res.getStatus());
                System.debug('MYDEBUG: ' + ' STATUS_CODE:'+ res.getStatusCode());
                System.debug('MYDEBUG: ' + ' GET_BODY:'+ res.getBody());
                XmlStreamReader reader = res.getXmlStreamReader();
                System.debug(reader.getLocalName());
                
            } catch(System.CalloutException e) {
                system.debug('MYDEBUG: AWS Service Callout Exception on ' + 'ERROR: ' + e.getMessage());
            }
 //   }

  	 //create authorization header for Amazon S3 REST API
    public string createAuthHeader(String method,String filename,String formattedDateString,String bucket,String key,String secret){
        string auth;
        String stringToSign = method+'\n\n\n'+formattedDateString+'\n/'+bucket +'/'+filename;
        Blob mac = Crypto.generateMac('HMACSHA1', blob.valueof(stringToSign),blob.valueof(secret));
        String sig = EncodingUtil.base64Encode(mac);
        auth = 'AWS' + ' ' + key + ':' + sig;
        return auth;
    }

The code returns all the folders and files in the bucket but I need to pass a parameter to only return the content of one folder.


 
Hi,

I have a requirement where the User dynamically selects a field from the dropdown(VF select Option) and i have to check whether those field values are available in a map or not.

I have a Select Option in Vf where all the "Account" fields will be available. The selected field's API name will be set in a get set "selectedField"

public String selectedField{get;set;} // This is the String where the API name of selected field will get set

and here is my code,

List<Account> accList = new List<Account>([SELECT Id,NumberofLocations__c FROM Account WHERE NumberofLocations__c != NULL]);

Map<String,Account> accMap = new Map<String,Account>(); 

for(Account acc:accList) {
    accMap.get(acc.selectedField); // Here is the problem, I need to get the value from the map based on the field selected by the user. I get an error                                                                 selectedField does not exist in Account object.
}

I tried an alternative,

for(Account acc:accList) {
     String val = 'acc.'+selectedField;
    accMap.get(val);   // No success with this approach too. 
}


Suggestions please ??