• raj kiran
  • NEWBIE
  • 25 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 29
    Questions
  • 20
    Replies
Hi All,

We are using the User-Agent OAuth Authentication Flow so that vendors can insert the data from thier internal/exteranal sites  buy using simple insert rest api endpoint call using javascript/ajax calls. 

we have shared the sample endpoint for authorization like 
https://login.salesforce.com/services/oauth2/authorize?response_type=token&
client_id=3MVG9lKcPoNINVBIPJjdw1J9LLJbP_pqwoJYyuisjQhr_LLurNDv7AgQvDTZwCoZuD
ZrXcPCmBv4o.8ds.5iE&redirect_uri=https%3A%2F%2Fwww.mysite.com%2Fuser_callback.jsp&
state=mystate 
 
so vendors would call the above endpoint and grant authorization like accept/reject pop getting displayed in thier front end screens for first time call,On sucessfully redirection. the screen gets redirect to redirect url mentioned in connected app. 
we have mentioned that redirect url as www.vendordoamin.page/sfdc.jsp. where sfdc.jsp is the page where user submited the date from. so when user authorizes via pop, the sfdc authorization servers should respond back with access token.  
Once the access token is received vendor should store the access through out the request and should use the same to insert the custom lead data via standard rest url generated via workbench. 

If incase the access token is expired , the request should be made to below url to get new token

POST /services/oauth2/token HTTP/1.1
Host: https://test.salesforce.com/
grant_type=refresh_token&client_id=3MVG9lKcPoNINVBIPJjdw1J9LLM82HnFVVX19KY1uA5mu0
QqEWhqKpoW3svG3XHrXDiCQjK1mdgAvhCscA9GE&client_secret=111111111121111
&refresh_token=your token here

We have used this apporach so that we can share authorize endpoint and code, simple authorization inputs from front end user when submitting data, and then system inserting data to sfdc.
(we want this simple approach so that many other vendor can simple insert our rest api code and can insert data)

Since the vendors are unable to test or help us with sfdc support I am bangging my head to replicate this cors issue in sfdc side. like 


Now for the problems
-- for the first time vendors were able to authorize
-- they got access token, however the second time for refreshing acess tokens they are getting CORS errors and unable to proceed further.
-- how do  i actually replicate the issue ? i had minimum expeirence in java web apps, but developing java based web app like using jsp, 
tomcat and rest webservice is only the way to replicate the cors issue? 
-- there are many sample codes but using maven/jaxb/some other rest api in eclipse /configuring buildpath is all hell for me.
-- Is there any other way to test  User-Agent OAuth Authentication Flow ??
-- if testing only via creation java project etc can anyone share any sample code/ eclipse configurtaion.


** already whitelisted  vendors domain in CORS option in saleforce.
Hi All,

We are using the User-Agent OAuth Authentication Flow so that vendors can insert the data from thier internal/exteranal sites  buy using simple insert rest api endpoint call using javascript/ajax calls. 

we have shared the sample endpoint for authorization like 
https://login.salesforce.com/services/oauth2/authorize?response_type=token&
client_id=3MVG9lKcPoNINVBIPJjdw1J9LLJbP_pqwoJYyuisjQhr_LLurNDv7AgQvDTZwCoZuD
ZrXcPCmBv4o.8ds.5iE&redirect_uri=https%3A%2F%2Fwww.mysite.com%2Fuser_callback.jsp&
state=mystate 
 
so vendors would call the above endpoint and grant authorization like accept/reject pop getting displayed in thier front end screens for first time call,On sucessfully redirection. the screen gets redirect to redirect url mentioned in connected app. 
we have mentioned that redirect url as www.vendordoamin.page/sfdc.jsp. where sfdc.jsp is the page where user submited the date from. so when user authorizes via pop, the sfdc authorization servers should respond back with access token.  
Once the access token is received vendor should store the access through out the request and should use the same to insert the custom lead data via standard rest url generated via workbench. 

If incase the access token is expired , the request should be made to below url to get new token

POST /services/oauth2/token HTTP/1.1
Host: https://test.salesforce.com/
grant_type=refresh_token&client_id=3MVG9lKcPoNINVBIPJjdw1J9LLM82HnFVVX19KY1uA5mu0
QqEWhqKpoW3svG3XHrXDiCQjK1mdgAvhCscA9GE&client_secret=111111111121111
&refresh_token=your token here

We have used this apporach so that we can share authorize endpoint and code, simple authorization inputs from front end user when submitting data, and then system inserting data to sfdc.
(we want this simple approach so that many other vendor can simple insert our rest api code and can insert data)

Since the vendors are unable to test or help us with sfdc support I am bangging my head to replicate this cors issue in sfdc side. like 


Now for the problems
-- for the first time vendors were able to authorize
-- they got access token, however the second time for refreshing acess tokens they are getting CORS errors and unable to proceed further.
-- how do  i actually replicate the issue ? i had minimum expeirence in java web apps, but developing java based web app like using jsp, 
tomcat and rest webservice is only the way to replicate the cors issue? 
-- there are many sample codes but using maven/jaxb/some other rest api in eclipse /configuring buildpath is all hell for me.
-- Is there any other way to test  User-Agent OAuth Authentication Flow ??
-- if testing only via creation java project etc can anyone share any sample code/ eclipse configurtaion.


** already whitelisted  vendors domain in CORS option in saleforce. 
Hi All,

I have implemented sites with guest users inserting data to custo object. the questions are on security related.
I have enabled click jack protection for both standard headers and header disabled. my vf page have header as false.
the shared vf page is now being used as iframe in external website . by using x frame option inside my vf page can we whitelist the domain of external website ? using the allow from parameter  x frame option? if yes  can anyone share sample code on how to ? the below is the code so far i can track 

HttpServletResponse response …;
response.addHeader(“X-FRAME-OPTIONS”, “Allow-From https://some.othersite.com”);

 I am  banging my head on how to use the httpservelt cide in my vf page,not sure how can i add this httpservletresponce code in vf pages as my page has simple apex form, fields and  submit method to send the data to sfdc custom object. as far i know if i am external website i can write request responce code in .jsp or java or php related etc, but its sfdc how do i proceed.

All related information shared are appreciated.

Regards,
Raj
Hi All,

I have an requirement where i need to have two forms shared to client so that they can use them in thier internal website in iframe etc something like an contact form etc where i will be receiving basic information for record insertion. one form will have customobject.souce = a and othe form will have customobject.souce = b.
I  have created two sites, two vf pages and two classes where i had coded in class such that when user enteres data in first site url,the souce will be a and when user enteres data in second site url the source willl be b. 
i am thinking to merge them in one site url, where i can use the hidden fileds and pass the value to class for different souce insertion. but the thing is that i need to share two different urls to client so that the input for souces will be taken care by client . so something if i share the client url like

(taking forms url as example for site url with different source as url parameter)
https://developer.salesforce.com/forums/?source=sourceA                          and for the other url as
https://developer.salesforce.com/forums/?source=sourceB

by the above way we can see that by using paramter from the url , i can get the value to class and then use it to store different source value in back end. but the question is that how can i do this in sites ?  where i need to have only one site domain , may be two or one VF page can be used.

 

0down votefavoriteI know this will be an known issue as most of you have faced it.i have searched and reached out to quite some tech folks but no luck in getting it resolved. question (1) Issue with CORS we have and use case where client will be making and rest api call from user browser using endpoint. we are using Oauth with user agent flow for authetincation purposes.i have tried adding cross orgin true in client side,added ip ranges for the client ip, added client domain in CORS option in sfdc and nothing worked.we have tested the endpoint from hurl. we are able to pass the authentication sucessfully first time and able to create records as well.However clients do not. when they are passing  values from browser ajax calls their initial request is not getting sucessfull they are getting CORS issue.
Sample code used by client :

$.ajax({
                                url: "https://sampledoamin.my.salesforce.com/services/oauth2/token",
                                method: "post",
                               crossOrigin: true,
                                contentType: "application/json",
                                dataType: 'json',
                                data: {
                                                "grant_type": "refresh_token",
                                                "client_id": "sample client id",
                                                "client_secret": "sample key",
                                                "refresh_token": "sample refresh token"
                                },
                                success: function (data) {
                                                console.log(data);
                                },
                                error: function () {
                                                console.log("authorization failed");
                                }
                });
 
we have used connected app, standard rest api.
Question (2) : Assuming the above issue gets resolved , Issue with access level Since we have shared standard rest url like    " https://domain.my.salesforce/services/data/v20.0/sobjects/custom_object_name_c " .  client need to have access for only data insertion , no access for looking into other records,modify,delete etc is required. Since this is an standard rest uri for custom object , could anyone let me know how to restrict other object access etc.
Appreciate for your valuable taughts on this.
Regards, Raj
Hi All, 
Below  i present you the code logic whic i am performing in clicking and button , where javascript is performed.
ideally once its clicked as per busines logic it should update few values in case object , but we are receiving  the below error sometimes when the button is clicked, I think in the current logic we are not using any getarray to reteive the records,could this be casuing the issue ?
Please share your taughts.
User-added image

Code is
 
{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/22.0/apex.js" )}
var connection = sforce.connection;


sforce.connection.sessionId = '{!$Api.Session_ID}';

var caseId = '{!Case.CaseNumber}';
var status = 'CANCELLED';
var caseStatus = '{!Case.Status}';
var taskstat = '{!Case.Task_Status__c}';
var cs = new sforce.SObject("Case");

if (taskstat == 'Incomplete for Parts' || taskstat == 'Incomplete for Time' || taskstat == 'Onsite'){
alert('Not A valid Task Status to Cancel it');
}
else{
//Start of CRF 46420
var result = sforce.connection.query("SELECT ShippingCountry FROM Account WHERE Id = '{!Case.AccountId}'");
if (result.records.ShippingCountry.contains('CA') || result.records.ShippingCountry.contains('CAN') || result.records.ShippingCountry.contains('Canada')){
cs.id = "{!Case.Id}";
if ('{!Case.BAAN_Cancel_Reason__c}'== null || '{!Case.BAAN_Cancel_Reason__c}' == ''){
cs.BAAN_Cancel_Reason__c = prompt('Enter Cancel Reason','{!Case.BAAN_Cancel_Reason__c}');
if (cs.BAAN_Cancel_Reason__c == null || cs.BAAN_Cancel_Reason__c == ''){
alert('Please Enter Cancel Reason and click OK to proceed further');
}
else{
if (cs.BAAN_Cancel_Reason__c.length > 254){
alert('Only 255 characters allowed');
}
else{
sforce.connection.update([cs]);
}
}
}
else{
cs.BAAN_Cancel_Reason__c = '{!Case.BAAN_Cancel_Reason__c}';
}
}
//End of CRF 46420
var msg = 'This will cancel the SR and the service tech will not go onsite. There will be a delay while the cancellation is processed. Proceed?';
//Start of CRF 46420
if ((result.records.ShippingCountry.contains('CA') || result.records.ShippingCountry.contains('CAN') || result.records.ShippingCountry.contains('Canada'))){
if (cs.BAAN_Cancel_Reason__c != null && cs.BAAN_Cancel_Reason__c != ''){
var c=confirm(msg);
}
}
else if (!(result.records.ShippingCountry.contains('CA') || result.records.ShippingCountry.contains('CAN') || result.records.ShippingCountry.contains('Canada'))){
var d=confirm(msg);
}
//End of CRF 46420
if (c==true)
{
var c = new sforce.SObject("Case");

alert('Dispatch cancelled');

c.id = "{!Case.Id}";
//Start of CRF 46420
c.BAAN_Cancel_Reason__c = cs.BAAN_Cancel_Reason__c;
//End of CRF 46420
// make the field change
c.Task_Status__c = "Cancelled";

// save the change
sforce.connection.update([c]);

//refresh the page
var url = parent.location.href;
parent.location.href = url; 
}
if(d==true){
window.alert('Cancel Dispatch request has been submitted.Please Wait');
var res = sforce.apex.execute('SRUpdateWrapper','WebserviceFunction',{extno:caseId,Status:status});
if (res != 'SUCCESS')
{
alert('Dispatch not cancelled ,Please contact your system administrator');
var c = new sforce.SObject("Case");

c.id = "{!Case.Id}";
// make the field change
c.Task_Status__c = "Dispatch is not Cancelled due to : "+res;

// save the change
sforce.connection.update([c]);

//refresh the page
var url = parent.location.href;
parent.location.href = url

}
else if (res == 'SUCCESS'){
var c = new sforce.SObject("Case");


alert('Dispatch cancelled');

c.id = "{!Case.Id}";
//Start of CRF 46420
c.BAAN_Cancel_Reason__c = cs.BAAN_Cancel_Reason__c;
//End of CRF 46420
// make the field change
c.Task_Status__c = "Cancelled";

// save the change
sforce.connection.update([c]);

//refresh the page
var url = parent.location.href;
parent.location.href = url; 
}
}
else
{
}	
}

 
I have strange issue, the below is my code which when executed in production and full copy sandbox the sub tabs are not opening. the wired part is that if I test the same in developer org it is working fine. Both the orgs have same code except for some alert message.
functionality : When service cloud users creates case and saved, it will redirect to detail page. On the detail page we are presenting some url to open. the code for opening the url is below.
Isuse : When user creates case and clicks on the first time link is not getting opened. but if the same case closed and reopned, the links works fine.
I need to understand why it is not working for the first time?

 
<apex:page standardController="Case">
    <A HREF="#" onClick="testOpenSubtab();return false">Detailed KB Search</A> 
    <apex:includeScript value="/support/console/22.0/integration.js"/>
    <script type="text/javascript">
        function testOpenSubtab(kb, sub) {
            //First find the ID of the primary tab to put the new subtab in
           sforce.console.getEnclosingPrimaryTabId(openSubtabNew);
alert("hi");
        }

        var openSubtabNew = function openSubtabNew(result) {
            //Now that we've got the primary tab ID, we can open a new subtab in it
            var primaryTabId = result.id;
            kb = "{!Case.KB_Product_URL__c}";
            sub = "{!Case.Subject}";
            var knowledgebaseurl;
            var category_type;
            var category_Value;
            category_type = "{!Case.Case_Type__c}" + " " +  "{!Case.Problem_symptom__c}"
           //alert(category_type);
            switch (category_type) {
               case 'Administration Initial Setup / Configuration' :  category_Value = 'c/4694,4707/kw/'; break;
                case 'Administration No Value' :  category_Value = 'c/4694,0/kw/'; break;
                case 'Administration Page Layout' :  category_Value = 'c/4694,4705/kw/'; break;
                case 'Administration User Administration' :  category_Value = 'c/4694,4706/kw/'; break;
                case 'Answer Lists and Trees No Value' :  category_Value = 'c/6045,0/kw/'; break;
                case 'Application Add Documents' :  category_Value = 'c/4692,4697/kw/'; break;
                case 'Application Coversheet' :  category_Value = 'c/4692,4698/kw/'; break;
                case 'Application Document List' :  category_Value = 'c/4692,4699/kw/'; break;
                case 'Application Email Link' :  category_Value = 'c/4692,4700/kw/'; break;
                case 'Application Error Code' :  category_Value = 'c/4692,4701/kw/'; break;
                case 'Application No Value' :  category_Value = 'c/4692,0/kw/'; break;
                case 'Bulletin Control Packages No Value' :  category_Value = 'c/584,0/kw/'; break;
                case 'Compatibility Testing No Value' :  category_Value = 'c/4033,0/kw/'; break;
                case 'Depot Repair Controller Board' :  category_Value = 'c/2566,2569/kw/'; break;
                case 'Depot Repair FCU' :  category_Value = 'c/2566,2571/kw/'; break;
                case 'Depot Repair No Value' :  category_Value = 'c/2566,0/kw/'; break;
                case 'Depot Repair Operation Panel' :  category_Value = 'c/2566,2568/kw/'; break;
                case 'Depot Repair Power Supply' :  category_Value = 'c/2566,2567/kw/'; break;
                case 'Developer Tools No Value' :  category_Value = 'c/588,0/kw/'; break;
                case 'Document Solutions Adaptec' :  category_Value = 'c/846,871/kw/'; break;
                case 'Document Solutions Doculex PDF Capture' :  category_Value = 'c/846,848/kw/'; break;
                case 'Document Solutions Documentum' :  category_Value = 'c/846,857/kw/'; break;
                case 'Document Solutions iManage' :  category_Value = 'c/846,858/kw/'; break;
                case 'Document Solutions ISIS' :  category_Value = 'c/846,899/kw/'; break;
                case 'Document Solutions Kofax Ascent Capture' :  category_Value = 'c/846,847/kw/'; break;
                case 'Document Solutions Kofax Ricochet' :  category_Value = 'c/846,859/kw/'; break;
                case 'Document Solutions No Value' :  category_Value = 'c/846,0/kw/'; break;
                case 'Document Solutions PixView' :  category_Value = 'c/846,911/kw/'; break;
                case 'Document Solutions Quantum Snap Server' :  category_Value = 'c/846,849/kw/'; break;
                case 'Document Solutions Rimage' :  category_Value = 'c/846,852/kw/'; break;
                case 'Documentation Cost Fact Sheets' :  category_Value = 'c/746,984/kw/'; break;
                case 'Documentation Installation Guides' :  category_Value = 'c/746,747/kw/'; break;
                case 'Documentation Licensing Info' :  category_Value = 'c/746,1013/kw/'; break;
                case 'Documentation Marketing Literature' :  category_Value = 'c/746,956/kw/'; break;
                case 'Documentation No Value' :  category_Value = 'c/746,0/kw/'; break;
                case 'Documentation Operator Manuals' :  category_Value = 'c/746,596/kw/'; break;
                case 'Documentation Parts Manuals' :  category_Value = 'c/746,957/kw/'; break;
                case 'Documentation Pricing' :  category_Value = 'c/746,985/kw/'; break;
                case 'Documentation Product Specifications' :  category_Value = 'c/746,797/kw/'; break;
                case 'Documentation Product Support Guides' :  category_Value = 'c/746,958/kw/'; break;
                case 'Documentation Release Notes' :  category_Value = 'c/746,960/kw/'; break;
                case 'Documentation RTB' :  category_Value = 'c/746,1216/kw/'; break;
                case 'Documentation Service Manuals' :  category_Value = 'c/746,959/kw/'; break;
                case 'Documentation Technical Information' :  category_Value = 'c/746,4155/kw/'; break;
                case 'Documentation Warranty Information' :  category_Value = 'c/746,614/kw/'; break;
                case 'Documentation White Papers' :  category_Value = 'c/746,583/kw/'; break;
                case 'Drivers/Utilities Camera Drivers' :  category_Value = 'c/581,988/kw/'; break;
                case 'Drivers/Utilities CD/DVD Drivers' :  category_Value = 'c/581,987/kw/'; break;
                case 'Drivers/Utilities LAN Fax Drivers' :  category_Value = 'c/581,809/kw/'; break;
                case 'Drivers/Utilities No Value' :  category_Value = 'c/581,0/kw/'; break;
                case 'Drivers/Utilities Print Drivers' :  category_Value = 'c/581,876/kw/'; break;
                case 'Drivers/Utilities Scanner Drivers' :  category_Value = 'c/581,862/kw/'; break;
                case 'Drivers/Utilities Scanner Drivers' :  category_Value = 'c/581,862/kw/'; break;
                case 'Drivers/Utilities Utilities' :  category_Value = 'c/581,1217/kw/'; break;
                case 'Emulator No Value' :  category_Value = 'c/1134,0/kw/'; break;
                case 'Enhancement Request No Value' :  category_Value = 'c/1172,0/kw/'; break;
                case 'Firmware Firmware Updates' :  category_Value = 'c/807,585/kw/'; break;
                case 'Firmware Firmware Subscriptions' :  category_Value = 'c/807,590/kw/'; break;
                case 'Firmware No Value' :  category_Value = 'c/807,0/kw/'; break;
                case 'GKM Support Best Practices' :  category_Value = 'c/5507,5523/kw/'; break;
                case 'GKM Support Common Questions' :  category_Value = 'c/5507,5517/kw/'; break;
                case 'GKM Support Documentation' :  category_Value = 'c/5507,5511/kw/'; break;
                case 'GKM Support GKM General' :  category_Value = 'c/5507,5508/kw/'; break;
                case 'GKM Support Master Lists' :  category_Value = 'c/5507,5525/kw/'; break;
                case 'GKM Support No Value' :  category_Value = 'c/5507,0/kw/'; break;
                case 'GKM Support Programs & Tools' :  category_Value = 'c/5507,5524/kw/'; break;
                case 'Global Asset No Value' :  category_Value = 'c/6492,0/kw/'; break;
                case 'Hot Topics No Value' :  category_Value = 'c/3349,0/kw/'; break;
                case 'How to Authentication/Password' :  category_Value = 'c/2574,4156/kw/'; break;
                case 'How to Counters/Meters' :  category_Value = 'c/2574,4624/kw/'; break;
                case 'How to Device Management' :  category_Value = 'c/2574,4163/kw/'; break;
                case 'How to Document Server' :  category_Value = 'c/2574,4176/kw/'; break;
                case 'How to Fax' :  category_Value = 'c/2574,696/kw/'; break;
                case 'How to Maintenance' :  category_Value = 'c/2574,2576/kw/'; break;
                case 'How to Networking' :  category_Value = 'c/2574,4175/kw/'; break;
                case 'How to No Value' :  category_Value = 'c/2574,0/kw/'; break;
                case 'How to Print' :  category_Value = 'c/2574,2577/kw/'; break;
                case 'How to Programming/Operation' :  category_Value = 'c/2574,582/kw/'; break;
                case 'How to Projection' :  category_Value = 'c/2574,6102/kw/'; break;
                case 'How to Scan' :  category_Value = 'c/2574,2578/kw/'; break;
                case 'How to Serial Number Locator' :  category_Value = 'c/2574,4623/kw/'; break;
                case 'How to Setup/Install' :  category_Value = 'c/2574,594/kw/'; break;
                case 'How to Video Conferencing' :  category_Value = 'c/2574,6101/kw/'; break;
                case 'Internal Support No Value' :  category_Value = 'c/975,0/kw/'; break;
                case 'Internal Support ROL' :  category_Value = 'c/975,974/kw/'; break;
                case 'Key/Signature Request Beta Signature' :  category_Value = 'c/970,4417/kw/'; break;
                case 'Key/Signature Request Demo Signature' :  category_Value = 'c/970,1141/kw/'; break;
                case 'Key/Signature Request Development Key' :  category_Value = 'c/970,972/kw/'; break;
                case 'Key/Signature Request Maintenance Signature' :  category_Value = 'c/970,4418/kw/'; break;
                case 'Key/Signature Request No Value' :  category_Value = 'c/970,0/kw/'; break;
                case 'Key/Signature Request Production Signature' :  category_Value = 'c/970,971/kw/'; break;
                case 'MFD Error Code' :  category_Value = 'c/4693,4704/kw/'; break;
                case 'MFD No Value' :  category_Value = 'c/4693,0/kw/'; break;
                case 'MFD Scanning' :  category_Value = 'c/4693,4702/kw/'; break;
                case 'MFD Software Installation' :  category_Value = 'c/4693,4703/kw/'; break;
                case 'Parts Accessories Bridge Unit / Interchange Unit' :  category_Value = 'c/597,598/kw/'; break;
                case 'Parts Accessories Document Feeder' :  category_Value = 'c/597,599/kw/'; break;
                case 'Parts Accessories Fax Option' :  category_Value = 'c/597,600/kw/'; break;
                case 'Parts Accessories Finisher/Bookmaker' :  category_Value = 'c/597,601/kw/'; break;
                case 'Parts Accessories Gears, Actuators, Brackets, Other' :  category_Value = 'c/597,658/kw/'; break;
                case 'Parts Accessories Memory, Hard Drive, DIMMS' :  category_Value = 'c/597,659/kw/'; break;
                case 'Parts Accessories No Value' :  category_Value = 'c/597,0/kw/'; break;
                case 'Parts Accessories Paper Bank / LCT' :  category_Value = 'c/597,602/kw/'; break;
                case 'Parts Accessories Paper Feed Unit' :  category_Value = 'c/597,1116/kw/'; break;
                case 'Parts Accessories PCBs' :  category_Value = 'c/597,655/kw/'; break;
                case 'Parts Accessories Print / Scan Option' :  category_Value = 'c/597,603/kw/'; break;
                case 'Parts Accessories Sorter' :  category_Value = 'c/597,604/kw/'; break;
                case 'Parts Base Machine Cassettes/Trays/Bypass' :  category_Value = 'c/606,628/kw/'; break;
                case 'Parts Base Machine Covers, Decals, Labels' :  category_Value = 'c/606,619/kw/'; break;
                case 'Parts Base Machine Documentation/Manuals/Software' :  category_Value = 'c/606,617/kw/'; break;
                case 'Parts Base Machine Drum/PCU Section' :  category_Value = 'c/606,611/kw/'; break;
                case 'Parts Base Machine Duplex Section' :  category_Value = 'c/606,612/kw/'; break;
                case 'Parts Base Machine Electrical Components' :  category_Value = 'c/606,615/kw/'; break;
                case 'Parts Base Machine Feed Section' :  category_Value = 'c/606,609/kw/'; break;
                case 'Parts Base Machine Fuser Section' :  category_Value = 'c/606,610/kw/'; break;
                case 'Parts Base Machine Gears, Actuators, Brackets, Other' :  category_Value = 'c/606,657/kw/'; break;
                case 'Parts Base Machine Master Eject' :  category_Value = 'c/606,621/kw/'; break;
                case 'Parts Base Machine Memory, Hard Drive, DIMMS' :  category_Value = 'c/606,656/kw/'; break;
                case 'Parts Base Machine No Value' :  category_Value = 'c/606,0/kw/'; break;
                case 'Parts Base Machine Optics Section' :  category_Value = 'c/606,613/kw/'; break;
                case 'Parts Base Machine PCBs' :  category_Value = 'c/606,607/kw/'; break;
                case 'Parts Base Machine Plotter Unit' :  category_Value = 'c/606,620/kw/'; break;
                case 'Parts Base Machine PM Kit' :  category_Value = 'c/606,618/kw/'; break;
                case 'Parts Base Machine Supplies' :  category_Value = 'c/606,629/kw/'; break;
                case 'Parts Base Machine Toner/Developer Section' :  category_Value = 'c/606,608/kw/'; break;
                case 'Parts Base Machine Transfer/Separation' :  category_Value = 'c/606,616/kw/'; break;
                case 'Printing Solutions AXIS' :  category_Value = 'c/941,851/kw/'; break;
                case 'Printing Solutions No Value' :  category_Value = 'c/941,0/kw/'; break;
                case 'Product Specifications No Value' :  category_Value = 'c/2761,0/kw/'; break;
                case 'Programming External Packages' :  category_Value = 'c/1129,1135/kw/'; break;
                case 'Programming Fax' :  category_Value = 'c/1129,1130/kw/'; break;
                case 'Programming General' :  category_Value = 'c/1129,1139/kw/'; break;
                case 'Programming No Value' :  category_Value = 'c/1129,0/kw/'; break;
                case 'Programming Panel / LCD' :  category_Value = 'c/1129,1133/kw/'; break;
                case 'Programming Print' :  category_Value = 'c/1129,1131/kw/'; break;
                case 'Programming RxOP' :  category_Value = 'c/1129,4234/kw/'; break;
                case 'Programming Scan' :  category_Value = 'c/1129,1132/kw/'; break;
                case 'Recycle No Value' :  category_Value = 'c/2616,0/kw/'; break;
                case 'RFG eSource Content Information' :  category_Value = 'c/622,626/kw/'; break;
                case 'RFG eSource General Info' :  category_Value = 'c/622,623/kw/'; break;
                case 'RFG eSource No Value' :  category_Value = 'c/622,0/kw/'; break;
                case 'RFG eSource Portal' :  category_Value = 'c/622,624/kw/'; break;
                case 'RFG eSource Searching' :  category_Value = 'c/622,625/kw/'; break;
                case 'RFG eSource Subscriptions' :  category_Value = 'c/622,627/kw/'; break;
                case 'RiDP Administration No Value' :  category_Value = 'c/1117,0/kw/'; break;
                case 'RNT TEST - DO NOT USE No Value' :  category_Value = 'c/4382,0/kw/'; break;
                case 'Safety/Environmental Disposal -Fuser Oil' :  category_Value = 'c/950,951/kw/'; break;
                case 'Safety/Environmental Disposal -PCU/AIO/Drum' :  category_Value = 'c/950,953/kw/'; break;
                case 'Safety/Environmental Disposal-Machine' :  category_Value = 'c/950,952/kw/'; break;
                case 'Safety/Environmental Disposal-Toner/Developer' :  category_Value = 'c/950,954/kw/'; break;
                case 'Safety/Environmental Material Safety Data Sheets-MSDS' :  category_Value = 'c/950,636/kw/'; break;
                case 'Safety/Environmental No Value' :  category_Value = 'c/950,0/kw/'; break;
                case 'Safety/Environmental Spill/Clean Up' :  category_Value = 'c/950,990/kw/'; break;
                case 'Safety/Environmental Toner Waste/Recycling' :  category_Value = 'c/950,891/kw/'; break;
                case 'Security Card Authentication Solution' :  category_Value = 'c/2760,4885/kw/'; break;
                case 'Security No Value' :  category_Value = 'c/2760,0/kw/'; break;
                case 'Supplies/Options Batteries' :  category_Value = 'c/589,983/kw/'; break;
                case 'Supplies/Options Fusing Oil' :  category_Value = 'c/589,756/kw/'; break;
                case 'Supplies/Options Fusing Unit' :  category_Value = 'c/589,755/kw/'; break;
                case 'Supplies/Options Ink' :  category_Value = 'c/589,979/kw/'; break;
                case 'Supplies/Options Maintenance Kits' :  category_Value = 'c/589,978/kw/'; break;
                case 'Supplies/Options Markers' :  category_Value = 'c/589,811/kw/'; break;
                case 'Supplies/Options Memory' :  category_Value = 'c/589,802/kw/'; break;
                case 'Supplies/Options NCR Paper' :  category_Value = 'c/589,980/kw/'; break;
                case 'Supplies/Options No Value' :  category_Value = 'c/589,0/kw/'; break;
                case 'Supplies/Options Paper Cassettes' :  category_Value = 'c/589,804/kw/'; break;
                case 'Supplies/Options Paper/Print Media' :  category_Value = 'c/589,5906/kw/'; break;
                case 'Supplies/Options Parts' :  category_Value = 'c/589,879/kw/'; break;
                case 'Supplies/Options PCU/AIO/Drum' :  category_Value = 'c/589,754/kw/'; break;
                case 'Supplies/Options PM Kits' :  category_Value = 'c/589,986/kw/'; break;
                case 'Supplies/Options Staples' :  category_Value = 'c/589,838/kw/'; break;
                case 'Supplies/Options Toner' :  category_Value = 'c/589,757/kw/'; break;
                case 'Supplies/Options Transfer Unit' :  category_Value = 'c/589,895/kw/'; break;
                case 'Supplies/Options Trays' :  category_Value = 'c/589,803/kw/'; break;
                case 'Supplies/Options USB2.0/SD Slot' :  category_Value = 'c/589,4416/kw/'; break;
                case 'testcategory No Value' :  category_Value = 'c/4555,0/kw/'; break;
                case 'Troubleshooting Authentication/Password' :  category_Value = 'c/2575,898/kw/'; break;
                case 'Troubleshooting Device Management' :  category_Value = 'c/2575,4177/kw/'; break;
                case 'Troubleshooting Document Server' :  category_Value = 'c/2575,4196/kw/'; break;
                case 'Troubleshooting Duplicator' :  category_Value = 'c/2575,741/kw/'; break;
                case 'Troubleshooting Electrical' :  category_Value = 'c/2575,700/kw/'; break;
                case 'Troubleshooting Error Messages/LED Light' :  category_Value = 'c/2575,587/kw/'; break;
                case 'Troubleshooting Faxing' :  category_Value = 'c/2575,2579/kw/'; break;
                case 'Troubleshooting Image Quality' :  category_Value = 'c/2575,630/kw/'; break;
                case 'Troubleshooting Jam/Transport' :  category_Value = 'c/2575,635/kw/'; break;
                case 'Troubleshooting Mechanical' :  category_Value = 'c/2575,716/kw/'; break;
                case 'Troubleshooting Networking' :  category_Value = 'c/2575,4195/kw/'; break;
                case 'Troubleshooting No Value' :  category_Value = 'c/2575,0/kw/'; break;
                case 'Troubleshooting Original Transport/Doc Feed' :  category_Value = 'c/2575,637/kw/'; break;
                case 'Troubleshooting Printing' :  category_Value = 'c/2575,705/kw/'; break;
                case 'Troubleshooting Projection' :  category_Value = 'c/2575,6104/kw/'; break;
                case 'Troubleshooting Scanning' :  category_Value = 'c/2575,708/kw/'; break;
                case 'Troubleshooting Service Codes' :  category_Value = 'c/2575,638/kw/'; break;
                case 'Troubleshooting Sorting/Finishing' :  category_Value = 'c/2575,683/kw/'; break;
                case 'Troubleshooting Troubleshooting Assistant' :  category_Value = 'c/2575,5094/kw/'; break;
                case 'Troubleshooting Video Conferencing' :  category_Value = 'c/2575,6103/kw/'; break;
                case 'User Access' :  category_Value = 'c/4691,4695/kw/'; break;
                case 'User No Value' :  category_Value = 'c/4691,0/kw/'; break;
                case 'User Password' :  category_Value = 'c/4691,4696/kw/'; break;
                case 'Service Codes Service Codes'  :  category_Value = 'c/2575,638,638/kw/'; break;
                case 'Service Codes SC100-SC199'  :  category_Value = 'c/2575,638,704/kw/'; break;
                case 'Service Codes SC200-SC299'  :  category_Value = 'c/2575,638,942/kw/'; break;
                case 'Service Codes SC300-SC399'  :  category_Value = 'c/2575,638,943/kw/'; break;
                case 'Service Codes SC400-SC499'  :  category_Value = 'c/2575,638,944/kw/'; break;
                case 'Service Codes SC500-SC599'  :  category_Value = 'c/2575,638,945/kw/'; break;
                case 'Service Codes SC600-SC699'  :  category_Value = 'c/2575,638,946/kw/'; break;
                case 'Service Codes SC700-SC799'  :  category_Value = 'c/2575,638,947/kw/'; break;
                case 'Service Codes SC800-SC899'  :  category_Value = 'c/2575,638,948/kw/'; break;
                case 'Service Codes SC900-SC999'  :  category_Value = 'c/2575,638,949/kw/'; break;
                case 'Service Codes SC1000 and above'  :  category_Value = 'c/2575,638,955/kw/'; break;
                case 'Service Codes SC000-SC099'  :  category_Value = 'c/2575,638,995/kw/'; break;
               default: category_Value = 'kw/';
            }
            var knowledgebaseurl;
            knowledgebaseurl = kb + "/" +  category_Value + sub + "/";
           //alert(category_Value);
           //alert(sub);
           //alert(knowledgebaseurl);
            if (kb == "") {
            knowledgebaseurl   = "https://gestetner.custhelp.com/app/home/";
                          }
            sforce.console.openSubtab(primaryTabId, knowledgebaseurl, true, 
                'KB Search Results', null, openSuccess, 'KBSubtab');
        };

        var openSuccess = function openSuccess(result) {
            //Report whether we succeeded in opening the subtab
            if (result.success == true) {
                //alert('subtab successfully opened');
            } else {
                //alert('subtab cannot be opened');
            }
        };
    </script>
</apex:page>

Any idea and suggestions are appreciated.

Regards,
Raj

 
Hi All,

I am getting the Non-selective query against large object type error when leads are getting inserted in the below trigger at Select_equipments_basedon_EquipIds function.right now the amount of equipment records are around 2,403,122.  
My questions are 
1) is there any way i can query all the data without adding the created date as where clasue ? as i need to query all the query during the trigger execution. 
2) If query data is not possible on all the data, can there is any alternative ??
3) i am planning to change the data type of lead colum(Equip_ID_Serial_Contract__c) used as set string in below code to external id , so that i can pass the external id to the query for faster processing . I am not sure if this would be helpful there are some values null,just text,and even random text / numbers etc. 
 
trigger Lead_Owner_Assign_Marketo on Lead (before insert, before update,before delete) 
{

    List <Lead__c> leadEntry =  Lead__c.getall().values();    
    List <Product_Interest__c> PIEntry = Product_Interest__c.getall().values();
    List <Telequal_Queue_Status__c> TQStatus = Telequal_Queue_Status__c.getall().values();
    Account accRec;
    Lead oldRec;
    Lead leadOldRec;
    String PRIMARY = 'PRIMARY';
    String SECONDARY = 'SECONDARY';
    Boolean flag = false;
    Boolean gflag = false;
    Boolean billflag = false;
    Boolean UpdateFlag = False;
    Boolean MFound = False;
    Set<ID> accountIds = new Set<ID>();
    Set<String> marketoAccountIds = new Set<String>();
    Set<String> equipSerialContractIds = new Set<String>();
    Set<String> PostalCodes = new Set<String>();
    List<Equipment__c> listEquipments = new List<Equipment__c>();
    List<Contract__c> listContracts = new List<Contract__c>();
    List<Territory_User__c> listTerrAssignmts = new List<Territory_User__c>();
    List<ID> finalAccList = new List<ID>();
    List<Account> listAccounts = new List<Account>();
    List<AccountTeamMember> AccountTeamMembers = new List<AccountTeamMember>();
    Set<ID> allUserList = new Set<ID>();
    List<User> userDetailList = new List<User>();
    //Set<Id> level1ManagerIds = new Set<Id>();
    Map<String,ID> contractAccountMap = new Map<String,ID>();
    Map<String,List<Territory_User__c>> geoUserMap = new Map<String,List<Territory_User__c>>();
    Map<ID,Account>IdAccountMap = new Map<ID,Account>();
    Map<String,ID> RforceAccountIdMap = new Map<String,ID>();
    Map<ID,List<AccountTeamMember>> teamMemberMap = new Map<ID,List<AccountTeamMember>>();
    Map<ID,Boolean> userStatusMap = new Map<ID,Boolean>();
    Map<ID,String> User_ManagerEmail_Map = new Map<Id,String>();
    Map<ID,ID> level1ManagerMap = new Map<ID,ID>(); 
    Map<ID,String> Manager_ManagerLevel2Map = new Map<ID,String>();
    Map<String,Map<String,String>> LeadRoleMap = new Map<String,Map<String,String>>();
    //Restricting IS Updates based on IS User
    public string user2;
    if(!Test.isRunningTest()){
      Name_of_IS_User__c User1 =   Name_of_IS_User__c.getInstance();
      user2= user1.User_Name_of_IS_Interface_User__c  ;
    }
    else if(Test.isRunningTest()){
       user2 = 'is.integration@ricoh-usa.com';
    }
    
    Profile CurrentProfile = [Select Name from Profile where Id =: UserInfo.getProfileId()];
        
    
    Id AccId;
    Lead c = new Lead();
  
                
  
        
    List<RecordType> RecordTypeList = [Select Id,Name,SobjectType,IsActive From RecordType where SobjectType = 'Lead' AND IsActive = True];
    Map<String,ID> RecordIdNameMap = new Map<String,ID>();
    for(RecordType recType:RecordTypeList)
    {
        RecordIdNameMap.put(recType.Name,recType.Id);
    }
    
    List<QueueSobject> que = [Select Id, SobjectType, QueueId, Queue.Name from QueueSobject where SobjectType = 'Lead'];
    Map<String,ID> queMap = new Map<String,ID>();
    Map<String,Boolean> queStatMap = new Map<String,Boolean>();
    
    system.debug('****Building Queues Map****');
    for(QueueSobject ques: que)
    {                
        queMap.put(ques.Queue.Name,ques.QueueId);                
    }
    system.debug('****Queue Map****'+queMap);
    for(Telequal_Queue_Status__c tqs: TQStatus)
    {
        queStatMap.put(tqs.Name,tqs.Queue_Status__c);
    }
    system.debug('****Telequalification Queue Status Map****');
    if(!NonBatchStaticHelper.hasTaskOpptySkipVariable())
    {
        if(!UserInfo.getUserName().Contains(user2))
        {
            system.debug('****inside LeadConverisonStaticHelper check ****');
            if(trigger.isInsert || trigger.isUpdate)
            {
                for(Lead newLead: Trigger.new)
                {
                    newLead.Enterprise_Services_Opp__c = newLead.Enterprise_Services__c;
                    newLead.Equipment_Opp__c = newLead.Equipment__c;
                    newLead.IT_Services_Opp__c = newLead.IT_Services__c;
                    newLead.Other_Not_Yet_Determined_Opp__c = newLead.Other_Not_Yet_Determined__c;
                    newLead.Print_Assessment_Opp__c = newLead.Print_Assessment__c;
                    newLead.Production_Print_Opp__c = newLead.Production_Print__c;
                    newLead.Service_Contract_Opp__c = newLead.Service_Contract__c;
                    newLead.Supplies_Printers_Opp__c = newLead.Supplies_Printers__c;
                    newLead.Sub_Source__c = newLead.Lead_Sub_Source__c;
                    newLead.Sub_Source_Contact__c = newLead.Lead_Sub_Source__c;
                    newLead.LDS_Opp__c=newLead.LDS__c;    
                    newLead.RPPS_Opp__c=newLead.RPPS__c;  

                    system.debug('****Build All Necessary Lists for SOQL query****');
                    if(Trigger.isUpdate && newLead.OwnerId != queMap.get('SSA Queue') && newLead.OwnerId != queMap.get('Telequalification Queue'))
                    {
                        allUserList.add(newLead.OwnerId);   
                    }
                    if(newLead.Account_Name_1__c != Null)
                    {
                        accountIds.add(newLead.Account_Name_1__c);  
                    }
                    else
                    {
                        if(newLead.Marketo_Account_ID__c!= Null && !newLead.Account_Delete_Flag__c)
                        {
                            marketoAccountIds.add(newLead.Marketo_Account_ID__c);    
                        }
                        if(newLead.Equip_ID_Serial_Contract__c!= Null && !newLead.Account_Delete_Flag__c)
                        {
                            equipSerialContractIds.add(newLead.Equip_ID_Serial_Contract__c);    
                        }
                        if(newLead.Shipping_Postal_Code__c!= Null)
                        {
                            PostalCodes.add(newLead.Shipping_Postal_Code__c);
                        }
                        if(newLead.PostalCode!= Null)
                        {
                            PostalCodes.add(newLead.PostalCode);
                        }
                    }
                    
                    if(newLead.Creation_Mode__c!=null)
                    {
                        system.debug('****Edge/IKON.COM Lead****');
                        if(newLead.Lead_Type__c=='Equipment')
                        {
                            newLead.Equipment__c = True;                  
                        }                  
                        else if(newLead.Lead_Type__c=='Service Contract')
                        { 
                            newLead.Service_Contract__c = True;                  
                        }                  
                        else if(newLead.Lead_Type__c=='Supplies / Printers')
                        { 
                            newLead.Supplies_Printers__c = True;                 
                        }                  
                        else if(newLead.Lead_Type__c=='Print Assessment')
                        {   
                            newLead.Print_Assessment__c = True;                 
                        }
                    }
                    
                    if(Trigger.isUpdate)
                    {
                    
                        leadOldRec = Trigger.oldMap.get(newLead.Id);
                        if(leadOldRec.OwnerId!=newLead.OwnerId)
                        {
                            if(UserInfo.getUserId() == leadOldRec.OwnerId && CurrentProfile.Name=='Ricoh Sales Rep' 
                                && newLead.OwnerId != queMap.get('SSA Queue') && newLead.OwnerId != queMap.get('Telequalification Queue'))
                            {
                                newLead.addError('You can not transfer this lead to another Sales Rep');
                            }
                            else if(UserInfo.getUserId() == leadOldRec.OwnerId && CurrentProfile.Name=='Ricoh Sales Rep' 
                                && (newLead.OwnerId != queMap.get('SSA Queue') || newLead.OwnerId != queMap.get('Telequalification Queue')))
                            {
                                newLead.Manually_Assigned__c = True;
                            }
                            else if(CurrentProfile.Name=='Ricoh Sales Process Team' || CurrentProfile.Name=='Ricoh Sales Support Analyst')
                            {
                                newLead.Manually_Assigned__c=True;
                            }
                        }
                        
                        
                        c=newLead; 
                        
                    }
                    
                       
                        AccId=newLead.Account_Name_1__c;
                        c=newLead;
                        
                } 
            }
			if(!equipSerialContractIds.isEmpty())
            {
                listEquipments = Select_equipments_basedon_EquipIds(equipSerialContractIds); 
                if(!listEquipments.isEmpty())
                {
                    system.debug('****Collect all the AccountIds linked to Equipments****');
                    for(Equipment__c eq: listEquipments)
                    {
                        accountIds.add(eq.Account__c);    
                    }
                }
                
            }
        
}
}

        public List<Equipment__c> Select_equipments_basedon_EquipIds(Set<String> equipSerialIds){
            List<Equipment__c> equipList = [Select Id, Account__c,ORC_equip_id__c,Name From Equipment__c Where Name IN:equipSerialIds OR ORC_equip_id__c IN:equipSerialIds];
            return equipList;
        } 
        }
Any light on this will be of great help 
Thanks in advance .

Regards,
Raj
 
Hi All, 

In my org, when ever user logs in, we have custom home components,in custom home components we have created  a vf page and have written logic is such a way that whenever user logs in, we check if its the new session from UserInfo.getSessionId to that of store the old sessionid  in objectB. we compare when ever user logs in and based on some flags fields we populate users a custom docuement accordingly.

if the flags are true it would present a docuement or else page will just refresh only once and rest is normal.

My issue is that for a single person in my org the page is getting refreshed again and again. when he clicks on opportunity or account tab the screen gets refreshed back to home page tab. ideally this should not happen.

this is my vf page :


<apex:page id="hompage" title="Homepage Visualforce" showheader="false" sidebar="false" cache="false" standardStylesheets="false" controller="SalesCompRemote">
<script type="text/javascript"> function getRemoteSalesComp()
{
var userId = '{!$User.Id}';
Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.SalesCompRemote.getRedirect}', userId,
function(result, event)
{ if (event.status )
{
if(result == true)
parent.parent.location.href = "/apex/SalesCompDefaultLandingPage?tsid={!$CurrentPage.parameters.tsid}";
}
},
{escape: true} ); } </script> <body onload="getRemoteSalesComp();"> </body> </apex:page>


the above mentioned vf is called/invoked for an ideal time about 2 min . like if user is idle for 2-5 minutes and if clicks on accounts tab, the screen gets refreshed back to home tab.  As per above code the user who is facing the iusse has the event value as false. so idealy the check should happen only once per login but here its happening again and specially on user clicks.

here is the controller : global class SalesCompRemote {

    public SalesCompRemote(){ }
    
    @RemoteAction
    global static Boolean getRedirect(String EmployeeId){
        system.debug('****INSIDE REMOTE METHOD****');
        Boolean redirect = False;
        Date CurrentDateStamp = Date.Today();
        system.debug('Line no 520 EmployeeId'+ EmployeeId);
        List<Sales_Compensation__c> SalesCompUpdate = new List<Sales_Compensation__c>();
        List<Sales_Compensation__c> SalescompRecList = [Select Id,  Session_Id__c FROM Sales_Compensation__c WHERE Status__c ='New' AND Template__c != null AND Start_Date__c <= :CurrentDateStamp AND Effective_Date__c != null AND Employee__c =:EmployeeId];
        Database.Saveresult[] updSave = new Database.Saveresult[]{};
        
        if(!SalescompRecList.isEmpty()){
            system.debug('UPDATE SESSION ID FOR ALL OPEN RECORDS');
            for(Sales_Compensation__c localRec :SalescompRecList ){                
                system.debug('Saved Session Id ' + localRec.Session_Id__c);
                system.debug('System Session Id'+UserInfo.getSessionId());              
                if(localRec.Session_Id__c <> UserInfo.getSessionId()){              
                    //redirect = True;
                    localRec.Session_Id__c = UserInfo.getSessionId();
                    SalesCompUpdate.add(localRec);
                }   
            } 
            updSave = Database.Update(SalesCompUpdate,false);            
            system.debug('update Save Result'+updSave); 
                    
        }
        List<Sales_Compensation__c> SalescompAckRecList = [Select Id,  Session_Id__c FROM Sales_Compensation__c WHERE Status__c ='New' AND Template__c != null AND Start_Date__c <= :CurrentDateStamp AND Effective_Date__c != null AND Employee__c =:EmployeeId ORDER BY End_Date__c NULLS LAST, Start_Date__c DESC LIMIT 1];
        if(!SalescompAckRecList.isEmpty() && !SalesCompUpdate.isEmpty() && !updSave.isEmpty()){
            for(Sales_Compensation__c compRec :SalescompAckRecList){
                if(compRec.Session_Id__c == UserInfo.getSessionId()){
                   redirect = True;
                }
            }
        }
        return redirect;
    }

}
 
Hi All,

I have approval process, for simplicity i am explaning with reference to sample approavl process, Example  i have kept  a condition like opportunity amount <10000 redirect to manager  or else  to comision team. at approval steps. If i submit the approval process by stanadard process, which is clicking on submit for approaval button  it is getting redirected  as required but with apex coding approval its does not properly do it.  This apex coding is used for auto submission for approval process when  some other field updates in the record happen.

Apex code used :
 Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();
                                    req.setComments('Submitted for approval. Please approve.');
                                    req.setObjectId(getting it from custom apex page and vf page);
                                    req.setSubmitterId(getting it from custom apex page and vf page);
 approvalReqList.add(req);  
 if(approvalReqList.size() > 0)
                    {
List<Approval.ProcessResult> result = Approval.process(approvalReqList,false);
}


Now  my question is there any chance that apex approval might skip the redirection check or basically missing  any other validation before submitting. ?? or are there any thing which i need to add any other login to check for opp amount  before submitting.

Please share your taught .


Thanks
Raj
Hi All,

Recently one of my QA instance has been refreshed, so like until before resfreshing was done, the external systems were able to connect to sfdc . hoever when the QA was refreshed with prod data, the connection got failed . and it says 

Exception in thread "main" java.lang.NoClassDefFoundError: com.sforce.soap.enterprise.fault.LoginFault

        at java.lang.J9VMInternals.verifyImpl(Native Method)

        at java.lang.J9VMInternals.verify(J9VMInternals.java:73)

        at java.lang.J9VMInternals.initialize(J9VMInternals.java:135)

Caused by: java.lang.ClassNotFoundException: com.sforce.soap.enterprise.fault.LoginFault

So i am wondering if we need to build new esdl etc or building new jars associated with them.
Hi All,

I have  some external sample system(oracle db) and i am trying to connect sfdc and load some of the data from sfdc and save it to external system. previously it was sucessful but when there was production refresh to QA, the programs connecting to QA are getting failed. please find the below log. I have checked the user and password they are working fine. any other pointer where should i look into ?

Log start ************************************************************************************
Calling Products Integration.....

command is..java com/ikon/oso/sfdc/RACSFA_ProductIntegration oracle.jdbc.OracleDriver ios10401e.dc.ricohonline.org 1510 SUPP APPS RAC_EBIZORAPASSWORD 75 **********@**************** RAC_SFDCPASSWORD ******************** https://test.salesforce.com/services/Soap/c/34.0/0DFa0000000CgUv

Exception in thread "main" java.lang.NoClassDefFoundError: com.sforce.soap.enterprise.fault.LoginFault

        at java.lang.J9VMInternals.verifyImpl(Native Method)

        at java.lang.J9VMInternals.verify(J9VMInternals.java:73)

        at java.lang.J9VMInternals.initialize(J9VMInternals.java:135)

Caused by: java.lang.ClassNotFoundException: com.sforce.soap.enterprise.fault.LoginFault

        at java.net.URLClassLoader.findClass(URLClassLoader.java:434)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:677)

        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:358)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:643)

        ... 3 more

Could not find the main class: com/ikon/oso/sfdc/RACSFA_ProductIntegration.  Program will exit.

Creating the output file.....

output file created successfully .
Hi All,

I am instaled kepler eclipse and trying to install the force.com ide plugin as suggested in the documnet in the mentioned url https://developer.salesforce.com/page/Force.com_IDE_Installation   for some reason if i enter the url and trying to download the plugin, the urs is down or somethiing, i checked the url and ist 404 error. please share me updated url to download the plugin.
Hi,

I have written a custom controller class  and couple of extension for standard controller to overide some basic functionality in some scenarios like adding more to save method etc.
My question is that if we open developer console , or if we acess apex class via eclipse how can we identify the extension with a custom controller class. As both are apex class in salesforce, i dont find any way to differentiate  between them?

Is naming convetion only way to identify? or is there any other way around?
Hi All,
I am wondering if any one could help me out this in maintenance question bugging me up. Its bit confusing and  i ended up in loosing the exam . Please let me know if anyone has the precise answer for this.

what is a capability of report notifications?
A. Users can subscribe to reports and set the notification criteria.
B. Users can configure automatic report notifications for public groups.
C. Users can schedule report notifications for their subordinates.
D. Users can schedule how often notifications are sent for each report.

I believe options "b" anc "d" are the right one. As automatic congurations using public groups are being done as per new release. but when it comes to  option "d" i feel option c is also possible.
Hi All,

I am looking for a way where we can implement the batch class which updates multiple object field values. here we will be passing the paramerts like api object names and field names to be updates dyamically.

Please let me know how can i acheive this?
Hi All,

I am looking for comparison of salesforce and mendix. Plese let me your inputs in all aspects.
Hi All,

I have wrapper class being used in front end to provide the check box functionality, i need to write the class as my code coverage is falling under the min coverage. I have googled many sites, yet the result was not much of use. if there are any suggestions or how should i proced ahead with writing the test class .

code for wrapper class:
 
public class CategoryWrapper {

    public Boolean checked{ get; set; }
    public users__c cat { get; set;}

    public CategoryWrapper(){
        cat = new users__c ();
        checked = false;
    }

    public CategoryWrapper(users__c c){
        cat = c;
        checked = false;
    }

 

}

controller :
public with sharing class LicenseOptimizerController
{

    map<string, Shift_Master__c> mapStrShiftMaster = new map<string, Shift_Master__c>();
    map<id, users__c> mapuser = new   map<id, users__c>();
    map<id, users__c> mapUserNew = new   map<id, users__c>();
    
    List<user> lst = new list<User>();
    list<case> objnewcase = new list<case>();
    list<string>  lstShiftType { get; set; }
    public List<categoryWrapper> lstStdUser{get;set;}
    
    set<id> objid = new set<id>();  
    set<id> setcaseID = new set<id>();
    set<id> setuserid = new set<id>(); 
    
    public boolean blVariable = false;
    public boolean blShowSearchPanel{ get; set; }
    public Boolean blStatusValue { get; set; }
    public boolean blActivateButton{get;set;}
    public boolean blDeactivateButton{get;set;}
    public boolean blShowUserDetail{get;set;}
    public Boolean blStatusCheck;
    
    Public Integer iPageRecordSize{get;set;}
    Public Integer iNoOfRecords{get; set;}
    
    
    public String strSelectedUser {get; set;} 
    public String[] strShiftType  {get; set;} 
    public string[] strProfileType  {get; set;} 
    
    public id idUser{get;set;}
    
    public LicenseOptimizerController()
    {
        strShiftType = new list<string>();
        strProfileType = new list<string>();
        
        blStatusValue=false;
        
        strShiftType.add('Regular');
        strShiftType.add('Evening');
        strShiftType.add('Afternoon');
        strShiftType.add('Night');
        
        strProfileType.add('Sales Rep');
        blShowUserDetail = true;
     
        blDeactivateButton =true;
        blActivateButton=false;
        
      //  refresh();
    }
    
    
    
    //used to get the deatil of seleted user on the detail page.
    public void getusername()
    {
        blShowUserDetail= true;
        idUser=[select id from user where Username=:strSelectedUser].id;
    }
    
    
    
    public List<categoryWrapper> getUsers() 
    {
   // blShowUserDetail= false;
        lstStdUser= new List<categoryWrapper>();
        if(blStatusValue)
        {
            blDeactivateButton =true;
           // 
            blActivateButton=false;
        }
        else
        {
            blActivateButton=true; 
            blDeactivateButton =false;  
        } 
        
        for (users__c  urs: [select id, name,Name__c, ProfileName__c, End_Time__c, Start_Time__c, Status__c,shift_type__c,User__c
                             from users__c where ( Status__c =:blStatusValue AND 
                                                  Shift_Type__c in: strShiftType AND
                                                  Profilename__c in : strProfileType            
                                                 ) ])
        lstStdUser.add(new CategoryWrapper(urs));
        
       
        return lstStdUser;
    }
    
    public pageReference refresh() 
    {
       // blShowUserDetail=false;
         ApexPages.getMessages().clear();
        getUsers();
        
        return null;
    }
    
    
    public List<SelectOption> getProfileType() 
    {
    List<SelectOption> options = new List<SelectOption>();
   // options.add(new SelectOption('a','a'));
   
   for(profile objprofile : [select id, name from profile order by name])
     options.add(new SelectOption(objprofile.name,objprofile.name));
        
        
        return options;
    }
    
    public List<SelectOption> getItems() 
    {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('10','10'));
        options.add(new SelectOption('20','20'));
        options.add(new SelectOption('30','30'));
        return options;
    }
    
    public void activate() 
    {
        users__c obj= new Users__c();
        
        
        for (CategoryWrapper cw : lstStdUser) {
            if (cw.checked){
                mapuser.put(cw.cat.user__c, cw.cat );    
                
            }
            }
           
            
            for(user objuser :[select id, isactive from user where id in : mapuser.keyset() ])
            {
                // mapUserNew.put(objuser.id, objuser);
                setuserid.add(objuser.id);
                
            }
            system.debug('set id of the seleced custom user'+setuserid);
            
            if(setuserid.size() > 0 && setuserid != null )
            {
                blStatusCheck = true;
                updateUserStatus(setuserid, blStatusCheck);
                 ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM,'Users are Activated '));
            }
             else
            {
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'Please select the User '));
            }
                updateCustUser();
            
            //refresh();
        
    }
    
    
    public void deactivate() 
    {
        users__c obj= new Users__c();
        
        for (CategoryWrapper cw : lstStdUser) {
            if (cw.checked)
            {
                mapuser.put(cw.cat.user__c, cw.cat );            //cw.cat.users__c will give the ID of the record
            }
        }
        
        assigncontactQueue();                    
        
        for(user objuser :[select id, isactive from user where id in : mapuser.keyset()])
        {
            setuserid.add(objuser.id);
            //mapUserNew.put(objuser.id, objuser);
        }
        
        if(setuserid.size() > 0 && setuserid != null )
        {
            blStatusCheck = false;
            updateUserStatus(setuserid, blStatusCheck);
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'Users Are Deactivated '));
        }
        else
        {
        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'Please select the User '));
        }
        

        updateCustUser();
         
        //refresh();
    }
    
    
    public void ShiftMaster()
    {
        for(Shift_Master__c objshift : [select Shift__c, End_Time__c  from Shift_Master__c ])
            mapStrShiftMaster.put(objshift.shift__c, objshift);
    }
    
    public void updateCustUser()
    {
        list<users__c> lstUsers = new list<users__c>();
        
        ShiftMaster();
        
        for(users__c objUsers : [select id, status__c, End_Time__c, Shift_Type__c from users__c where user__c in : setuserid ])
        {
            if(blStatusCheck == false)
            {
                objUsers.status__c = false ; 
                lstUsers.add(objUsers);
            }
            else if(blStatusCheck == true)
            {
                objUsers.End_Time__c = mapStrShiftMaster.get(objUsers.Shift_Type__c ).End_Time__c ;
                blActivateButton=false; 
                blDeactivateButton =false;
                objUsers.status__c = true;
                lstUsers.add(objUsers);
            }
        }
        if(lstusers.size() > 0 && lst != null)
            update lstUsers ;
    }
    
    @future
    private static void updateUserStatus(set<id> setuserid, Boolean blStatusCheck)
    {   
        LoopStop.tempvar = false;
        List<user> lst = new list<User>();
        
        for(user objuser :[select id, isactive from user where id in : setuserid])
        {
            if(blStatusCheck == false)
            {
                objuser.isactive= false;
                lst.add(objuser);
            }
            else if(blStatusCheck == true)
            {
                objuser.isactive= true;
                lst.add(objuser);
            }
        }
        
        if (lst.size()>0 && lst != null)
        {
            update lst;
        }
    }   

    
    public void assigncontactQueue()
    {
        string queueID = [SELECT id,Name FROM Group WHERE Name = 'CaseQueue'].id;
        
        for(case objcon : [select id,ownerid from case where ownerid in : mapuser.keyset()])
        {
            objcon.OwnerId = queueID;            
            objnewcase.add(objcon);
        }
        
        if(objnewcase.size() > 0 && objnewcase != null)
            update objnewcase ;
    }
}

 
Hi All,
I am using jquery datatable to display data in vf.i am refering static zip resources which packs the jquery.dataTables.css,jquery-1.11.1.min.js,jquery.dataTables.min.js and another images folder to hold the sort icons to be displayed beside colums.

If i am refring all these files on cdn network the data table works fine with all sort icons are being displayed. however if i am using my static resources the sort icons are missing.
Eg expected sort icons are here in below example
http://www.datatables.net/examples/basic_init/zero_configuration.html

The sort icons are being referred in jquery.dataTables.css.
The path referred for images in jquery.dataTables.css file as per cdn network is

background: url("../images/sort_both.png") no-repeat center right;
background: url("../images/sort_asc.png") no-repeat center right;

since these jquery.dataTables.css ,images and js files are zipped into static resources, i am given these path below in jquery.dataTables.css  file and none of them worked.

a) background: url("../images/sort_both.png") no-repeat center right;
b) background: url("{!URLFOR($Resource.myZipFile, images/sort_both.png)}") no-repeat center right;

please let me know the right way to refer the image path in the css for salesforce static resources.
 
Hi All,

I am working on case where a scheduled batch calling a future method/class. As salesforce restricts the future call from batch , i am looking for any other alternative or workaround for this .

I need to use the future call  in schedule batch because , the dml operation i do in future call is on configuration object, performing dml operation on configuration objects causes us Mixed DML exception . To over come this error we need to use the future call.

Any light on this is of great help.
Hi All,

I am looking for architecture of approval process, this helps me in undertsanding the process instance, process history and process node etc, tables in related to approval process such that my motto in firing and email or an notification when an approaval is peding at certain stage if it is more than certain period.

Regards,
raj

 
Hi All,

We are using the User-Agent OAuth Authentication Flow so that vendors can insert the data from thier internal/exteranal sites  buy using simple insert rest api endpoint call using javascript/ajax calls. 

we have shared the sample endpoint for authorization like 
https://login.salesforce.com/services/oauth2/authorize?response_type=token&
client_id=3MVG9lKcPoNINVBIPJjdw1J9LLJbP_pqwoJYyuisjQhr_LLurNDv7AgQvDTZwCoZuD
ZrXcPCmBv4o.8ds.5iE&redirect_uri=https%3A%2F%2Fwww.mysite.com%2Fuser_callback.jsp&
state=mystate 
 
so vendors would call the above endpoint and grant authorization like accept/reject pop getting displayed in thier front end screens for first time call,On sucessfully redirection. the screen gets redirect to redirect url mentioned in connected app. 
we have mentioned that redirect url as www.vendordoamin.page/sfdc.jsp. where sfdc.jsp is the page where user submited the date from. so when user authorizes via pop, the sfdc authorization servers should respond back with access token.  
Once the access token is received vendor should store the access through out the request and should use the same to insert the custom lead data via standard rest url generated via workbench. 

If incase the access token is expired , the request should be made to below url to get new token

POST /services/oauth2/token HTTP/1.1
Host: https://test.salesforce.com/
grant_type=refresh_token&client_id=3MVG9lKcPoNINVBIPJjdw1J9LLM82HnFVVX19KY1uA5mu0
QqEWhqKpoW3svG3XHrXDiCQjK1mdgAvhCscA9GE&client_secret=111111111121111
&refresh_token=your token here

We have used this apporach so that we can share authorize endpoint and code, simple authorization inputs from front end user when submitting data, and then system inserting data to sfdc.
(we want this simple approach so that many other vendor can simple insert our rest api code and can insert data)

Since the vendors are unable to test or help us with sfdc support I am bangging my head to replicate this cors issue in sfdc side. like 


Now for the problems
-- for the first time vendors were able to authorize
-- they got access token, however the second time for refreshing acess tokens they are getting CORS errors and unable to proceed further.
-- how do  i actually replicate the issue ? i had minimum expeirence in java web apps, but developing java based web app like using jsp, 
tomcat and rest webservice is only the way to replicate the cors issue? 
-- there are many sample codes but using maven/jaxb/some other rest api in eclipse /configuring buildpath is all hell for me.
-- Is there any other way to test  User-Agent OAuth Authentication Flow ??
-- if testing only via creation java project etc can anyone share any sample code/ eclipse configurtaion.


** already whitelisted  vendors domain in CORS option in saleforce. 
Hi All, 
Below  i present you the code logic whic i am performing in clicking and button , where javascript is performed.
ideally once its clicked as per busines logic it should update few values in case object , but we are receiving  the below error sometimes when the button is clicked, I think in the current logic we are not using any getarray to reteive the records,could this be casuing the issue ?
Please share your taughts.
User-added image

Code is
 
{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/22.0/apex.js" )}
var connection = sforce.connection;


sforce.connection.sessionId = '{!$Api.Session_ID}';

var caseId = '{!Case.CaseNumber}';
var status = 'CANCELLED';
var caseStatus = '{!Case.Status}';
var taskstat = '{!Case.Task_Status__c}';
var cs = new sforce.SObject("Case");

if (taskstat == 'Incomplete for Parts' || taskstat == 'Incomplete for Time' || taskstat == 'Onsite'){
alert('Not A valid Task Status to Cancel it');
}
else{
//Start of CRF 46420
var result = sforce.connection.query("SELECT ShippingCountry FROM Account WHERE Id = '{!Case.AccountId}'");
if (result.records.ShippingCountry.contains('CA') || result.records.ShippingCountry.contains('CAN') || result.records.ShippingCountry.contains('Canada')){
cs.id = "{!Case.Id}";
if ('{!Case.BAAN_Cancel_Reason__c}'== null || '{!Case.BAAN_Cancel_Reason__c}' == ''){
cs.BAAN_Cancel_Reason__c = prompt('Enter Cancel Reason','{!Case.BAAN_Cancel_Reason__c}');
if (cs.BAAN_Cancel_Reason__c == null || cs.BAAN_Cancel_Reason__c == ''){
alert('Please Enter Cancel Reason and click OK to proceed further');
}
else{
if (cs.BAAN_Cancel_Reason__c.length > 254){
alert('Only 255 characters allowed');
}
else{
sforce.connection.update([cs]);
}
}
}
else{
cs.BAAN_Cancel_Reason__c = '{!Case.BAAN_Cancel_Reason__c}';
}
}
//End of CRF 46420
var msg = 'This will cancel the SR and the service tech will not go onsite. There will be a delay while the cancellation is processed. Proceed?';
//Start of CRF 46420
if ((result.records.ShippingCountry.contains('CA') || result.records.ShippingCountry.contains('CAN') || result.records.ShippingCountry.contains('Canada'))){
if (cs.BAAN_Cancel_Reason__c != null && cs.BAAN_Cancel_Reason__c != ''){
var c=confirm(msg);
}
}
else if (!(result.records.ShippingCountry.contains('CA') || result.records.ShippingCountry.contains('CAN') || result.records.ShippingCountry.contains('Canada'))){
var d=confirm(msg);
}
//End of CRF 46420
if (c==true)
{
var c = new sforce.SObject("Case");

alert('Dispatch cancelled');

c.id = "{!Case.Id}";
//Start of CRF 46420
c.BAAN_Cancel_Reason__c = cs.BAAN_Cancel_Reason__c;
//End of CRF 46420
// make the field change
c.Task_Status__c = "Cancelled";

// save the change
sforce.connection.update([c]);

//refresh the page
var url = parent.location.href;
parent.location.href = url; 
}
if(d==true){
window.alert('Cancel Dispatch request has been submitted.Please Wait');
var res = sforce.apex.execute('SRUpdateWrapper','WebserviceFunction',{extno:caseId,Status:status});
if (res != 'SUCCESS')
{
alert('Dispatch not cancelled ,Please contact your system administrator');
var c = new sforce.SObject("Case");

c.id = "{!Case.Id}";
// make the field change
c.Task_Status__c = "Dispatch is not Cancelled due to : "+res;

// save the change
sforce.connection.update([c]);

//refresh the page
var url = parent.location.href;
parent.location.href = url

}
else if (res == 'SUCCESS'){
var c = new sforce.SObject("Case");


alert('Dispatch cancelled');

c.id = "{!Case.Id}";
//Start of CRF 46420
c.BAAN_Cancel_Reason__c = cs.BAAN_Cancel_Reason__c;
//End of CRF 46420
// make the field change
c.Task_Status__c = "Cancelled";

// save the change
sforce.connection.update([c]);

//refresh the page
var url = parent.location.href;
parent.location.href = url; 
}
}
else
{
}	
}

 
Hi All,

I have approval process, for simplicity i am explaning with reference to sample approavl process, Example  i have kept  a condition like opportunity amount <10000 redirect to manager  or else  to comision team. at approval steps. If i submit the approval process by stanadard process, which is clicking on submit for approaval button  it is getting redirected  as required but with apex coding approval its does not properly do it.  This apex coding is used for auto submission for approval process when  some other field updates in the record happen.

Apex code used :
 Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest();
                                    req.setComments('Submitted for approval. Please approve.');
                                    req.setObjectId(getting it from custom apex page and vf page);
                                    req.setSubmitterId(getting it from custom apex page and vf page);
 approvalReqList.add(req);  
 if(approvalReqList.size() > 0)
                    {
List<Approval.ProcessResult> result = Approval.process(approvalReqList,false);
}


Now  my question is there any chance that apex approval might skip the redirection check or basically missing  any other validation before submitting. ?? or are there any thing which i need to add any other login to check for opp amount  before submitting.

Please share your taught .


Thanks
Raj
Hi All,

I am instaled kepler eclipse and trying to install the force.com ide plugin as suggested in the documnet in the mentioned url https://developer.salesforce.com/page/Force.com_IDE_Installation   for some reason if i enter the url and trying to download the plugin, the urs is down or somethiing, i checked the url and ist 404 error. please share me updated url to download the plugin.
Hi All,

I am looking for a way where we can implement the batch class which updates multiple object field values. here we will be passing the paramerts like api object names and field names to be updates dyamically.

Please let me know how can i acheive this?
Hi All,

I am working on case where a scheduled batch calling a future method/class. As salesforce restricts the future call from batch , i am looking for any other alternative or workaround for this .

I need to use the future call  in schedule batch because , the dml operation i do in future call is on configuration object, performing dml operation on configuration objects causes us Mixed DML exception . To over come this error we need to use the future call.

Any light on this is of great help.
Hi All,

I am looking for soql which could fetch me all the license used for all inactive and active users in one shot. similar to displaying company license information in native SFDC environment.

I am working on displaying the license information on VF such that i can have my own custom activation and deactivation of users in organization.

Any light on this is greatly appreciated.
Hi All,

I am using the standard set controller to dispaly a list of records and do the pagination.
Here i need to set the page size of the dispalyed records per page dynamically. eg like an selectlist values from vf
like select records/page dropdown to value having 10,20,50 and upon the selection by submiting some(update button) the number of records per page shoud get updated.

 i have seen a post here :
http://saramorgan.net/2014/11/11/pagination-and-the-standardsetcontroller-no-custom-controller-required/
 which has the same funcationality i am looking for however he has used the standard opptunity controller to acheive it. in my case i am using the custom controller and using the standard set controller to acheive it.

can any one let me know how can i acheive the dynamic paging size from vf using the stadard set controller ?

Regards
Raj
 
Hi All,

I am using an approval process  onlead ,with custom business lead status and recod types . once the approval of the lead record is done approval action will change the states,recod types to next users to approve.On the last step of the approval completion, its assoicated action will update the status to "authorised", recordtype  to "authorisedRC" and the owner changes to different profile users(say profileuserA).

The below error
"Record type unavailable
Cannot find default record type of the appropriate type. "
pops up during the covert button click of the "profileuserA" - current record owner. the same error goes for the admin also.

I have checked the profile setting for "profileuserA" for lead. As there are multiple recordtypes for custom lead status, we have made certain status and default page layout assignments to each profile involved in approval process such that the user will not be bothered about the record type while editing or while approving.

here profileuserA has the leadconvert app permission and also to the admin. however i am bit unclear with the recordtypes associated during and lead convert.

Any light on this error ?

Regards,
Raj
 
I need help on showing list of user licences in Visualforce Page. Is this possible? If yes, please send me the steps to follow.
hi,
   I wrote a trigger in which i am simply checking the id = null or not.....
The scenario is :
1) on lead object I have created 4 steps approval process
2) when a record is inserted then user has to click on the approval process "submit " button .
3) when i click this button then in processinstance object a record will be created with the targetobject id with the lead record and there is a field in lead object which get updated for every approval process .....

now when i check the record in workbench then it's showing it but when i am trying to get the same record thro' trigger then it's showing me null record...

here is the code :
trigger leadSubmitForApproval on lead (after update) {
set<id> setleadid=new set<id>();
 for (lead opp: Trigger.New)
{       
  if (trigger.oldmap.get(opp.id).Status != opp.Status &&  opp.RecordTypeID == '01290000001AJWz')
 {            
    setleadid.add(opp.id);
}    
}


for(ProcessInstance obj : [select  id,SystemModstamp from ProcessInstance
                where targetobjectid in : setleadid
                and CompletedDate = Null AND  Status = 'Pending' ])

        System.debug('Submitted for approval successfully: '+obj.id);      
}
}

output for the first time : Rows: 0  // I am nt getting the record only when i run it for first time
so , can anyone help me on this.
I tried my best to make  the scenario clear .

thanks in advance..........
Hi All,

My objective was to write and workflow/trigger to fire an email notification when the approval time between the steps in approval process takes more than some specific time. So, i was trying to fetch the timestamp from each step such that if the time stamp is greater than of required period then an email will be fired according step related user/queue.

To fetch the time stamp i wrote an SOQL query between the processdefinition,processinstance,processinstance step. which is

SELECT ID,(SELECT Id, (SELECT ElapsedTimeInMinutes, FROM ProcessInstanceStep) FROM ProcessInstance ) FROM ProcessDefinition WHERE Id = ‘some value’

Here for every record creation in an approval process there will be a new process instance id created keeping process definition kind of master id as reference . And for every process instance id, there will be associated step id created for approavl steps for a record in approval.

Now the question is that i an unable to understand the realtion between these 3 tables to frame my query as my query fails when it reads the subquery select.

Please let me know how can i over come this problem.

Regards,
Raj
Hi All,

I am looking for architecture of approval process, this helps me in undertsanding the process instance, process history and process node etc, tables in related to approval process such that my motto in firing and email or an notification when an approaval is peding at certain stage if it is more than certain period.

Regards,
raj

 
Hello Dears,

Please let me know how to implement Pagination with Standard Controller and Extension used in Apex:Page.
Kindly assist on this.


Thanks,
Rohit Sharma
Hi All,

I am learning salesforce from a month time now, i am  not so clear with permission sets.
As i had gone through some documents on web i got the information that permission sets  are used  giving some additional permission like acess to fields rather than changing profiles all the time.

My first question is, are the permission sets only used for granting acess to fields that profiles restrict them not to ? is this the only use? are they any more useful cases where we can use the permission sets?

On the other side, i tried to grant "edit " functionality on a custom object in recruting application using permissin sets to a profle where it has only read and creat . however the granted permission was not working as the profile  restricted  them to read and create. so this leaves me to conclude that profile settings cannot be superced by permision sets . Am i correct here ?

Please let me if i in right direction.


Thanks for your inputs.
Regards,
Raj

Hi Team,

 

We want to implement Natural Processing Language(NPL) Search Algorithms in salesforce. Please let me know if anyone have any idea on it.

 

Thanks,

Anil