• Igor Androsov 22
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
I want to update a Record Types on any Sobject regardless what type it is and seem not able to find correct API in APEX
Did try Describe calls that does not do it like this one
sObject sObj = Schema.getGlobalDescribe().get(ObjectName).newSObject() ;

Code below will be great if it worked, in Winter 18 has Syntax errors and methods are not found.

SObject record = Id.valueOf('a0Ci000000vd7xA').getSObjectType.newSObject();
record.put('RecordTypeId', <place ID object here>); 

Any other ideas that do work!

 
I am using Community as Identity for my Heroku app via OAuth Web Server flow. Standard login works ok.
Now I need to pass a custom parameter to my controller during this Login flow and do not see a way to do this. I try to use URL params but that get removed during redirect of OAuth dance/flow.

My community page is passing parameter if I hit that URL directly. But if I use community URL it does not get this parameter. That seems to be restricted set what can be passed to OAuth as documented here: https://developer.salesforce.com/page/Digging_Deeper_into_OAuth_2.0_on_Force.com

But I want to know if it is possible, anyone has done it to pass any custom parameter from initial request to Controller?
In My example, I need to add parameter <URL>?poi=999 to my OAuth request and get this value in my Login controller.
My current URL format that does not work: https://<COMMUNITY HOST>/services/oauth2/authorize?response_type=code&poi=999&client_id=<MY LONG CLIENT ID>&redirect_uri=http://localhost:8080/authorized&prompt=login consent&display=page
 
Any idea what this SOS error mean Code=3002?
com.salesforce.sos Code=3002 "Failed to start an SOS Session https://d.la2w2.salesforceliveagent.com/chat/rest/SosClient/SosRequest Request failed: internal server error (500)" UserInfo={NSLocalizedDescription=Failed to start an SOS Session https://d.la2w2.salesforceliveagent.com/chat/rest/SosClient/SosRequest Request failed: internal server error (500)}
Quickstart SOS Package install on sandbox does not work, install always gets an error related to LockerService in Lightning and package cannot install. This is the initial step to set up SOS in ORG a major stopper. Was anyone able to set upSOS and pass this error?

Error in defaultHandler for event: markup://aura:clientOutOfSync [Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' chrome-extension: https://sfdc.azureedge.net *.cs61.visual.force.com https://ssl.gstatic.com/accessibility/".
I am using Community as Identity for my Heroku app via OAuth Web Server flow. Standard login works ok.
Now I need to pass a custom parameter to my controller during this Login flow and do not see a way to do this. I try to use URL params but that get removed during redirect of OAuth dance/flow.

My community page is passing parameter if I hit that URL directly. But if I use community URL it does not get this parameter. That seems to be restricted set what can be passed to OAuth as documented here: https://developer.salesforce.com/page/Digging_Deeper_into_OAuth_2.0_on_Force.com

But I want to know if it is possible, anyone has done it to pass any custom parameter from initial request to Controller?
In My example, I need to add parameter <URL>?poi=999 to my OAuth request and get this value in my Login controller.
My current URL format that does not work: https://<COMMUNITY HOST>/services/oauth2/authorize?response_type=code&poi=999&client_id=<MY LONG CLIENT ID>&redirect_uri=http://localhost:8080/authorized&prompt=login consent&display=page
 
Hi,
I want to display batch classes status__c (status__C=In Progress,complete,cancelled.....) of particular batch__C of student in piechart,suppose if student has  4 batches,I have to display piechart for single batch and its status__C of batchclass object.but i am not able to repeat it,Instead I am getting all batches batchclasses status in single piechart.below is my code,can anyone helpme to solve it.

controller:
=========


public class facultydatadashboard {

public class facultydatadashboard {

public list<Faculty__c> faculty{set;get;}

public list<Batch__c> batchlist{set;get;}

public list<Batch_Class__c> batchclass{set;get;}
public list<Task__c> tasklist{set;get;}


public list<string> batchesId{set;get;}

public list<facultywrapper> facultywrapperpiechart{set;get;}
public list<facultywrapper> facultywrapperpiechart1{set;get;}
public list<facultywrapper> facultywrapperpieconstruct{set;get;}

public list<Batch_Class__c> bcllist{set;get;}

public map<id,Batch__c> batchmap{set;get;}

public facultydatadashboard(){

batchesId = new list<string>();
batchmap = new map<id,Batch__c>();

batchlist = [select id,name,Faculty__c,Faculty__r.name from Batch__c where Faculty__c='a06O000000aXV1k'];

    for(Batch__c b : batchlist){
        batchesId.add(b.id);
        batchmap.put(b.id,b);
        

       
       
    }
    
    batchclass = [select id,name,Status__c,Batch__c,Batch__r.name from Batch_Class__c where Batch__c = :batchesId];
    
    
tasklist = [select id,name,Faculty__c,Faculty__r.name,status__c from Task__c where Batch__c = :batchesId];
    




   
  
  
  

}

public list<batch__c> getbatch(){
    facultywrapperpiechart = new list<facultywrapper>();

batchlist = [select id,name,Faculty__c,Faculty__r.name from Batch__c where Faculty__c='a06O000000aXV1k'];

return batchlist ;
}

/*public list<facultywrapper> getbatchcla(){

return null;
}*/

public list<facultywrapper> getbatchclasschartofbatch(){

map<id,list<Batch_Class__c>> batchclasschart = new map<id,list<Batch_Class__c>>();
    facultywrapperpiechart1 = new list<facultywrapper>();


for(Batch_Class__c bbb : batchclass){

    if(batchclasschart.get(bbb.batch__c) == null){
         list<Batch_Class__c> b = new list<Batch_Class__c>(); 

     b.add(bbb);
     batchclasschart.put(bbb.batch__c,b);
    }
    else{
           list<Batch_Class__c> b1 = new list<Batch_Class__c>(); 
           b1=batchclasschart.get(bbb.batch__c);
           b1.add(bbb);
           batchclasschart.put(bbb.batch__c,b1);

    }
    
}

 set<id> b11 = new set<id>(); 
b11= batchclasschart.keyset();


for(Id batchid : b11){
system.debug('batchid '+batchid );



bcllist = batchclasschart.get(batchid);

system.debug('bcllist'+bcllist );

for(Batch_Class__c bcccl:bcllist ){
system.debug('bcccl'+bcccl);

        facultywrapperpiechart1.add(new facultywrapper(bcccl.status__c,batchclasschart.get(bcccl.batch__c).size(),bcccl.batch__r.name));
        }

}





 
 
return facultywrapperpiechart1;
}




public class facultywrapper{

public string name{set;get;}
public decimal data{set;get;}
public Batch_Class__c bc{set;get;}
public string batchname{set;get;}

//-------------



public facultywrapper(string n,decimal d,string bn){

this.name = n;
this.data= d;
this.batchname=bn;







 
 

}






}




-----------------------------

<apex:page controller="facultydatadashboard">
 
    
    batchclasschartofbatch
    <apex:repeat value="{!batchclasschartofbatch}">
        <apex:chart height="250" width="450" data="{!batchclasschartofbatch}" > 
            <apex:pieSeries tips="true" dataField="data" labelField="name"/> 

            <apex:legend position="bottom"/>
        </apex:chart>

</apex:repeat>
</apex:page>

 
  • March 15, 2017
  • Like
  • 0
Hi, guys.

I've setup static variable for preventing trigger recursion.
Class is below.
public Class checkRecursive{
    private static boolean run = true;
    
    public static boolean runOnce(){
    	if(run){
    		run=false;
    		return true;
    	}
        else
        	return run;
 		
    }

}

This class worked. worked. was.
However, it dosen't work now, I don't know why it stops working.

1. When I use just 1 trigger and use this static function, the 'run' value is already false, so the function returns false at the first time.
    Why?
2. I use this class and the same function for several trigger.
    Is this problem?

Please!!!!
Share your expertise.
Thanks in advance.


 
How to open a case tab of a console app as a classic tab

Thanks in advance
 
I am developing a Lightning Component based off the tutorial for the Account List Lightning Component. In the Apex Controller, I want to modify the query to only select records related to the currently viewed record. I tried using ApexPages.currentPage().getParameters().get('id') but it didn't work. The user would be viewing the details of a particular Event when this code would run. How can I get the current Event record ID in the Apex Controller of a Lightning Component?

Here is the turotial I am referring to:https://developer.salesforce.com/trailhead/project/slds-lightning-components-workshop/slds-lc-6