-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
12Questions
-
14Replies
how to check if I have salesforce shield
Thanks
- saad mechiche alami
- June 07, 2018
- Like
- 0
Adding a new filter field to a VF table
I am taking the hand from another developer code who have built a VF page that displays a table, on top of this page are 4 inpuText fields, those fields are used to filter certain columns of the table,
Store, would filter the Store name column
transaction id, would filter transaction id column
and same thing for the dates
when the user type a value into those inpuText fields, the table shrink dynamically and shows only the lines that have the right value
ex= if store column has store1, store2, store3 on the full table
and the user types store2 into the storename inpuText then the table shows only the correct lines that have only the store2 value, and this is working fine for this storename field
I have added a new outputlabel with the value "transaction type" and an input text next to it called {!transactype} on the VF page (see code below)
<!--saad-- adding transaction type------------------------------> <apex:outputLabel value="Transaction Type" styleClass="outputlabel"/> <apex:inputText value="{!transactype}" styleClass="inputTextClass"> <apex:actionSupport event="onkeyup" action="{!searchTransaction}" reRender="transtbleid" immediate="false" /> </apex:inputText> <!--saad-- adding transaction type------------------------------>
in the controller I have added the transactype string into the class
//saad adding transactiontype public string transactype{get; set;} //saad
and added the following line to the searchtransaction function to filter on the transaction type
//saad else if(transactype!=null && transactionID==null && storeName==null && eachWrp.transactionType.contains(transactype) && transactionDateFrom==null && transactionDateTo==null) { allTransactionWrper.add(eachWrp); } //saad
however when I type into the transactype new field added to the vf page, the table is not filtered and do not return the correct lines, like for the other inputtext fields= storename, transactionID, transactionDateFrom, transactionDateTo
I did not understand what is missing in the code, could you please help me, here is the full vf page and controller code
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
VF Page
<apex:page controller="LbwTransactionSummaryCtrl" id="pageid" docType="html-5.0"> <script> var lastRow; function highlight(elem){ if(lastRow != undefined) lastRow.style.backgroundColor = 'white'; elem.style.backgroundColor = '#8470FF'; lastRow = elem; } </script> <style> .tableHeader{ background: #9E9E9E; color: white; font-weight: bold; //padding: 4px; //border: 1px solid #9E9E9E; text-align: center; font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 10px; height: 20px; } .tableData{ border-collapse: collapse; text-align: center; font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 10px; background: white; border-right:thin solid; border-color:white; border-bottom: 1px solid #9E9E9E; border-right: 1px solid #9E9E9E; border-left: 1px solid #9E9E9E; height: 15px; width: 100%; } tableData : hover{ background-color: yellow; } .tableClass{ width: 100%; //background: #9E9E9E; border-collapse: collapse; } .inputTextClass{ background: #eee; color: black; //font-weight: bold; //padding: 4px; //border: 1px solid #ccc; text-align: left; font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 10px; width: 90%; } .outputlabel{ color: black; font-weight: bold; font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 12px; } </style> <apex:form id="formid"> <br/> <apex:panelGrid columns="10" width="100%" id="panelgrid"> <!--<apex:outputLabel value="Customer :" styleClass="outputlabel"/> <apex:outputLabel value="{!contactName}" styleClass="outputlabel"/>--> <apex:outputLabel value="Store" styleClass="outputlabel"/> <apex:inputText value="{!storeName}" styleClass="inputTextClass"> <apex:actionSupport event="onkeyup" action="{!searchTransaction}" reRender="transtbleid" immediate="false" /> </apex:inputText> <!--saad-- adding transaction type------------------------------> <apex:outputLabel value="Transaction Type" styleClass="outputlabel"/> <apex:inputText value="{!transactype}" styleClass="inputTextClass"> <apex:actionSupport event="onkeyup" action="{!searchTransaction}" reRender="transtbleid" immediate="false" /> </apex:inputText> <!--saad-- adding transaction type------------------------------> <apex:outputLabel value="Transaction ID" styleClass="outputlabel"/> <apex:inputText value="{!transactionID}" styleClass="inputTextClass"> <apex:actionSupport event="onkeyup" action="{!searchTransaction}" reRender="transtbleid" immediate="false" /> </apex:inputText> <apex:outputLabel value="Date Range : From" styleClass="outputlabel"/> <!--<apex:inputText value="{!transactionDate}" id="fromdateid" onclick="DatePicker.pickDate(false, 'pageid:formid:panelgrid:fromdateid', false);" />--> <apex:input type="date" value="{!transactionDateFrom}" styleClass="inputTextClass"> <apex:actionSupport event="onchange" action="{!searchTransaction}" reRender="transtbleid" immediate="false" /> </apex:input> <apex:outputLabel value="To" styleClass="outputlabel" /> <apex:input type="date" value="{!transactionDateTo}" styleClass="inputTextClass"> <apex:actionSupport event="onchange" action="{!searchTransaction}" reRender="transtbleid" immediate="false" /> </apex:input> </apex:panelGrid> <br/> <apex:outputPanel id="transtbleid"> <table class="tableClass"> <tr class="tableHeader"> <th width="6%" style="text-align: center;">Transaction<br/> ID</th> <th width="6%" style="text-align: center;">Transaction<br/> Type</th> <th width="7%" style="text-align: center;">Total Spend<br/> before tax</th> <th width="7%" style="text-align: center;">Total Spend<br/> after tax</th> <th width="7%" style="text-align: center;">Total Points<br/> Earned</th> <th width="7%" style="text-align: center;">Total Points<br/> Redeemed</th> <th width="8%" style="text-align: center;">Total Dollars<br/> Off(Offer)</th> <th width="9%" style="text-align: center;">Total Dollars<br/> Off(Redemption)</th> <th width="9%" style="text-align: center;">Store<br/> Name</th> <th width="6%" style="text-align: center;">Transaction<br/> Date</th> <th width="7%" style="text-align: center;">Transaction<br/> Time</th> <th width="9%" style="text-align: center;">Device Friendly<br/> Name</th> </tr> <apex:repeat value="{!allTransactionWrper}" var="eachTrns"> <tr class="tableData" onclick="highlight(this);" onMouseOver="highlight(this);"> <td ><apex:outputLabel value="{!eachTrns.transactionID}"> <apex:actionSupport action="{!displaySelectedTransaction}" event="onclick" reRender="transdetail"> <apex:param name="transNameindex" value="{!eachTrns.transactionID}"/> </apex:actionSupport> </apex:outputLabel> </td> <td ><apex:outputLabel value="{!eachTrns.transactionType}"> <apex:actionSupport action="{!displaySelectedTransaction}" event="onclick" reRender="transdetail"> <apex:param name="transNameindex" value="{!eachTrns.transactionID}"/> </apex:actionSupport> </apex:outputLabel> </td> <td ><apex:outputLabel value="{!eachTrns.totalSpendBeforeTax}"> <apex:actionSupport action="{!displaySelectedTransaction}" event="onclick" reRender="transdetail"> <apex:param name="transNameindex" value="{!eachTrns.transactionID}"/> </apex:actionSupport> </apex:outputLabel> </td> <td><apex:outputLabel value="{!eachTrns.totalSpendAfterTax}"> <apex:actionSupport action="{!displaySelectedTransaction}" event="onclick" reRender="transdetail"> <apex:param name="transNameindex" value="{!eachTrns.transactionID}"/> </apex:actionSupport> </apex:outputLabel> </td> <td><apex:outputLabel value="{!eachTrns.totalPointsEarned}"> <apex:actionSupport action="{!displaySelectedTransaction}" event="onclick" reRender="transdetail"> <apex:param name="transNameindex" value="{!eachTrns.transactionID}"/> </apex:actionSupport> </apex:outputLabel> </td> <td><apex:outputLabel value="{!eachTrns.totalPointsRedeemed}"> <apex:actionSupport action="{!displaySelectedTransaction}" event="onclick" reRender="transdetail"> <apex:param name="transNameindex" value="{!eachTrns.transactionID}"/> </apex:actionSupport> </apex:outputLabel> </td> <td><apex:outputLabel value="{!eachTrns.totalDollarsOffer}"> <apex:actionSupport action="{!displaySelectedTransaction}" event="onclick" reRender="transdetail"> <apex:param name="transNameindex" value="{!eachTrns.transactionID}"/> </apex:actionSupport> </apex:outputLabel> </td> <td><apex:outputLabel value="{!eachTrns.totalDollarspointRedemption}"> <apex:actionSupport action="{!displaySelectedTransaction}" event="onclick" reRender="transdetail"> <apex:param name="transNameindex" value="{!eachTrns.transactionID}"/> </apex:actionSupport> </apex:outputLabel> </td> <td><apex:outputLabel value="{!eachTrns.storeName}"> <apex:actionSupport action="{!displaySelectedTransaction}" event="onclick" reRender="transdetail"> <apex:param name="transNameindex" value="{!eachTrns.transactionID}"/> </apex:actionSupport> </apex:outputLabel> </td> <td><apex:outputLabel value="{!eachTrns.transDate}"> <apex:actionSupport action="{!displaySelectedTransaction}" event="onclick" reRender="transdetail"> <apex:param name="transNameindex" value="{!eachTrns.transactionID}"/> </apex:actionSupport> </apex:outputLabel> </td> <td><apex:outputLabel value="{!eachTrns.transactionTime}"> <apex:actionSupport action="{!displaySelectedTransaction}" event="onclick" reRender="transdetail"> <apex:param name="transNameindex" value="{!eachTrns.transactionID}"/> </apex:actionSupport> </apex:outputLabel> </td> <td><apex:outputLabel value="{!eachTrns.deviceFriendlyName}"> <apex:actionSupport action="{!displaySelectedTransaction}" event="onclick" reRender="transdetail"> <apex:param name="transNameindex" value="{!eachTrns.transactionID}"/> </apex:actionSupport> </apex:outputLabel> </td> </tr> </apex:repeat> </table> </apex:outputPanel> <br/> <apex:outputPanel id="transdetail"> <apex:outputPanel rendered="{!displayTransactionDtl}"> <table class="tableClass"> <tr class="tableHeader"> <th width="6%" style="text-align: center;">Transaction ID</th> <th width="4%" style="text-align: center;">Category</th> <th width="7%" style="text-align: center;">UPC</th> <th width="3%" style="text-align: center;">Quantity</th> <th width="7%" style="text-align: center;">Price Before<br/> Tax</th> <th width="7%" style="text-align: center;">Points Earned<br/> from Mass Offer</th> <th width="8%" style="text-align: center;">Points Earned<br/> from Targeted Offer</th> <th width="9%" style="text-align: center;">Points Earned<br/> from PCF</th> <th width="9%" style="text-align: center;">Points Earned<br/> from Total Spend</th> <th width="9%" style="text-align: center;">Offer Details</th> </tr> <apex:repeat value="{!allTransactionDtlWrper}" var="eachTrns"> <tr class="tableData"> <td>{!eachTrns.transactionID}</td> <td>{!eachTrns.category}</td> <td>{!eachTrns.upc}</td> <td>{!eachTrns.quantity}</td> <td>{!eachTrns.priceBeforeTax}</td> <td>{!eachTrns.ptsEarnedMassOffer}</td> <td>{!eachTrns.ptsEarnedTargetedOffer}</td> <td>{!eachTrns.ptsEarnedPCF}</td> <td>{!eachTrns.ptsEarnedTotalSpend}</td> <td>{!eachTrns.offerDetails}</td> </tr> </apex:repeat> </table> </apex:outputPanel> <br/> </apex:outputPanel> </apex:form> </apex:page>
APEX Controller
public without sharing class LbwTransactionSummaryCtrl { public list<TransactionWrper> allTransactionWrper{get;set;} private list<TransactionWrper> allTransactionWrperOriginal{get;set;} public list<TransactionDetailWrper> allTransactionDtlWrper{get;set;} public boolean displayTransactionDtl{get;set;} public string contactName{get;set;} public string selectedTransactionId{get;set;} public string transactionID{get; set;} public string storeName{get; set;} //saad adding transactiontype public string transactype{get; set;} //saad public string transactionDate{get; set;} public Date transactionDateFrom{get; set;} public Date transactionDateTo{get; set;} public LbwTransactionSummaryCtrl(){ //Getting contact name contactName=Apexpages.currentpage().getParameters().get('cntname'); system.debug('contactName=========>'+contactName); allTransactionWrper=new list<TransactionWrper>(); allTransactionWrperOriginal=new list<TransactionWrper>(); Integer tempCounter=0; while(tempCounter<10){ TransactionWrper eachTrans=new TransactionWrper(); eachTrans.transactionID=934234523+tempCounter+''; eachTrans.transactionType='External'; eachTrans.totalSpendBeforeTax=3456+''+tempCounter; eachTrans.totalSpendAfterTax=84548+''+tempCounter; eachTrans.totalPointsEarned=876+''+tempCounter; eachTrans.totalPointsRedeemed=324+''+tempCounter; eachTrans.totalDollarsOffer=7832+''+tempCounter; eachTrans.totalDollarspointRedemption=567+''+tempCounter; eachTrans.storeName='Loblaw Store No.'+tempCounter; eachTrans.transactionDate='10/26/2016'; eachTrans.transDate=Date.Today().addDays(tempCounter); eachTrans.transactionTime='10:34 AM'; eachTrans.deviceFriendlyName='Mobile'; allTransactionWrperOriginal.add(eachTrans); Integer tempCounterInner=0; while(tempCounterInner<4){ TransactionDetailWrper tdwr=new TransactionDetailWrper(); tdwr.transactionID=eachTrans.transactionID; tdwr.category='Mobile'; tdwr.upc='74458758'; tdwr.quantity='10'; tdwr.priceBeforeTax='$'+tempCounterInner; tdwr.ptsEarnedMassOffer='$'+tempCounterInner; tdwr.ptsEarnedTargetedOffer='$'+tempCounterInner; tdwr.ptsEarnedPCF='$'+tempCounterInner; tdwr.ptsEarnedTotalSpend='$'+tempCounter; tdwr.offerDetails='100 points for every $2 spent'; eachTrans.transactionDetails.add(tdwr); tempCounterInner++; } tempCounter++; } allTransactionWrper.addAll(allTransactionWrperOriginal); } public void displaySelectedTransaction(){ displayTransactionDtl=true; selectedTransactionId=Apexpages.currentpage().getParameters().get('transNameindex'); system.debug('selectedTransactionId========>'+selectedTransactionId); allTransactionDtlWrper=new list<TransactionDetailWrper>(); if(selectedTransactionId!=null){ for(TransactionWrper tWrper : allTransactionWrper){ if(selectedTransactionId.equals(tWrper.transactionID)){ allTransactionDtlWrper=tWrper.transactionDetails; } } } } public class TransactionWrper{ public string transactionID{get; set;} public string transactionType{get; set;} public string totalSpendBeforeTax{get; set;} public string totalSpendAfterTax{get; set;} public string totalPointsEarned{get; set;} public string totalPointsRedeemed{get; set;} public string totalDollarsOffer{get; set;} public string totalDollarspointRedemption{get; set;} public string storeName{get; set;} public string transactionDate{get; set;} public Date transDate{get; set;} public string transactionTime{get; set;} public string deviceFriendlyName{get; set;} public list<TransactionDetailWrper> transactionDetails{get;set;} public TransactionWrper(){ transactionDetails=new list<TransactionDetailWrper>(); } } public class TransactionDetailWrper{ public string transactionID{get; set;} public string category{get;set;} public string upc{get; set;} public string quantity{get; set;} public string priceBeforeTax{get; set;} public string ptsEarnedMassOffer{get;set;} public string ptsEarnedTargetedOffer{get;set;} public string ptsEarnedPCF{get;set;} public string ptsEarnedTotalSpend{get;set;} public string offerDetails{get;set;} } public void searchTransaction(){ system.debug('transactionDateFrom=======>'+transactionDateFrom); allTransactionWrper.clear(); for(TransactionWrper eachWrp: allTransactionWrperOriginal){ if(transactionID!=null && storeName==null && eachWrp.transactionID.contains(transactionID) && transactionDateFrom==null && transactionDateTo==null){ allTransactionWrper.add(eachWrp); } //saad else if(transactype!=null && transactionID==null && storeName==null && eachWrp.transactionType.contains(transactype) && transactionDateFrom==null && transactionDateTo==null){ allTransactionWrper.add(eachWrp); } //saad else if(storeName!=null && transactionID==null && eachWrp.storeName.toLowerCase().contains(storeName.toLowerCase()) && transactionDateFrom==null && transactionDateTo==null){ allTransactionWrper.add(eachWrp); } else if(storeName!=null && transactionID!=null && eachWrp.storeName.toLowerCase().contains(storeName.toLowerCase()) && eachWrp.transactionID.contains(transactionID) && transactionDateFrom==null && transactionDateTo==null){ allTransactionWrper.add(eachWrp); } else if(storeName!=null && transactionID!=null && eachWrp.storeName.toLowerCase().contains(storeName.toLowerCase()) && eachWrp.transactionID.contains(transactionID) && transactionDateFrom!=null && transactionDateTo!=null && eachWrp.transDate>=transactionDateFrom && eachWrp.transDate<=transactionDateTo){ allTransactionWrper.add(eachWrp); } else if(storeName==null && transactionID==null && eachWrp.storeName.toLowerCase().contains(storeName.toLowerCase()) && eachWrp.transactionID.contains(transactionID) && transactionDateFrom!=null && transactionDateTo!=null && eachWrp.transDate>=transactionDateFrom && eachWrp.transDate<=transactionDateTo){ allTransactionWrper.add(eachWrp); } } } }
- saad mechiche alami
- October 29, 2016
- Like
- 0
Filter email based on keywords and route them to separate queue
Is their a way in salesforce to filter email within salesforce by searching all emails having a keyword and then route all the filtered email to a separate queue ?
Thanks
- saad mechiche alami
- August 05, 2016
- Like
- 0
Trigger before Update [I cannot update fields]
in the following code, I would like that some fields to be autopopulated when the status is equal to 'CAN'
In the code:
if(smc.status__c=='CAN')
the 2 fields are these ones:
smc.SVMXC__Canceled_On__c=datetime.now();
smc.SVMXC__Active__c=false;
When the trigger is launched nothing get updated.
Could you please help
Many thanks
trigger ServiceContractCanceled_beforeInsert on SVMXC__Service_Contract__c (before update) { for(List<SVMXC__Service_Contract__c> IsCanceledServiceContract: [select Id,Status__c,ReasonForCancellation__c,SVMXC__Canceled_On__c,SVMXC__Active__c from SVMXC__Service_Contract__c where Id IN: Trigger.New]){ for(SVMXC__Service_Contract__c smc : IsCanceledServiceContract) { if(smc.status__c=='CAN') { if(smc.ReasonForCancellation__c==null){ Trigger.new[0].addError('Please set the reason for cancellation'); Trigger.new[0].ReasonForCancellation__c.addError('Reason for Cancellation should not be empty'); } smc.SVMXC__Canceled_On__c=datetime.now(); smc.SVMXC__Active__c=false; } } } }
- saad mechiche alami
- November 17, 2014
- Like
- 0
Trigger field is not Writeable
In the code below I am trying to put a contract owner in the opportunity team record and i want to grand him read/write permission in that record
My issue is that when i try to save that record, I get an error message saying
Error: Compile Error: Field is not writeable: OpportunityTeamMember.OpportunityAccessLevel at line 27 column 1
can you please help, many thanks
trigger OpportunityBeforeUpdate1 on Opportunity (before update) { string oppName; opportunity oppId; SVMXC__Service_Contract__c smc= new SVMXC__Service_Contract__c(); for (opportunity opp: trigger.new) oppName=opp.name; oppId=[select Id, name from opportunity where name=:oppname limit 1]; integer res=oppName.indexof(' - '); String ConName=oppName.left(res); smc=[select name, OwnerId from SVMXC__Service_Contract__c where name=:ConName limit 1]; OpportunityTeamMember oppt = new OpportunityTeamMember(); oppt.OpportunityId=oppId.Id; oppt.userid=smc.ownerid; oppt.OpportunityAccessLevel='edit'; oppt.TeamMemberRole='Service Sales Contributor'; insert oppt; }
- saad mechiche alami
- November 06, 2014
- Like
- 0
Insufficient privelege reason on logs
Is it possible to know why a user doesn't have the right to create a record thanks to the debugs logs ?
I am in a scenario where i have given a user a permission set to create read edit delete contact records , the new button is displayed on the contact but he still get the insufficient privilege message, and I really dont know what is blocking.
If you could help me with that, that would be really great
Thanks again
- saad mechiche alami
- November 04, 2014
- Like
- 0
User has no access to contact dispite profile and Permission set CRED
I currently have a user that cannot create a contact dispite giving his profile all CRED and assigning him a permission set with CRED on contact
Can you please help.
Many thanks
- saad mechiche alami
- November 04, 2014
- Like
- 0
Visualforce put data in the right column on a table
In the sceen above I need to put a date on
the lead date column if the stock quantity = 0
the expected ship date if the stock quantity !=0
the code that I have is not doing that,
Concerned part in my code:
View:
<apex:column > <apex:facet name="header">Expected<br>ship date</br></apex:facet> <apex:outputText value="{0,date, dd-MMM-yyyy}" ><apex:param value="{!Stock_date}" /></apex:outputText> </apex:column> <apex:column > <apex:facet name="header">Lead date</apex:facet> <apex:outputText value="{0,date, dd-MMM-yyyy}" ><apex:param value="{!Non_Stock_date}" /></apex:outputText> </apex:column>
Controller:
if (pl.partLine.Available_stock__c!=0){ //in case the stock is different than 0 Stock_date=pl.partLine.SVMXC__Expected_Receipt_Date__c; Non_Stock_date=null; } else{ Stock_date=null; Non_Stock_date = pl.partLine.SVMXC__Expected_Receipt_Date__c; }
I have attached the whole code to this message.
Thanks for your help
- saad mechiche alami
- November 03, 2014
- Like
- 0
Error when insterting contentversion in a unit test
I am currently runing a test where i need to query the contentversion object , in my test i have added the following lines :
ContentVersion cv = new ContentVersion(contentdocumentid='069L00000000xEI'); insert cv;
however , when i run my test i get the following error :
Could you please help , many thanks
- saad mechiche alami
- May 15, 2014
- Like
- 0
Create custom settings for a unit test
I need to create a custom setting for my unit test
the custom setting object name is called Terms_of_Use
how can i program that ?
many thanks
- saad mechiche alami
- May 15, 2014
- Like
- 0
Invalid Type Error message for a unit Test
cut_off_controler coc = new cutt_off_controler();
here is my Class followed by my unit Test:
public with sharing class cut_off_controler { public string cutoff {get; set;} public cut_off_controler (ApexPages.StandardController order){ setcutoff(); } //tranform the cuttoff time (4pm cet) to local user time public void setcutoff(){ //get the user's timezone string usertz = string.valueof(userinfo.getTimeZone()); time cuttime; //get the current time in gmt and tranform it to hour //convert the gmt time to paris time tranform it to hour DateTime dateingmt = datetime.now(); String datehourParis = dateingmt.format('HH','Europe/Paris'); String datehourgmt = dateingmt.format('HH','GMT'); system.debug('date gmt' + dateingmt ); system.debug('date hour gmt' + datehourgmt ); system.debug('date hour paris' + datehourParis ); integer hourgmt = integer.valueOf(datehourgmt); integer hourparis = integer.valueOf(datehourParis); //get the difference bewteen the gmt et paris time to know if we are in summer or spring time integer zone = hourparis - hourgmt; system.debug('date zone' + zone); //if we are in summer time / spring time adjuste the cutt off time consequently if(zone == 2){ cuttime = time.newInstance(14, 0, 0, 0); }else{ cuttime = time.newInstance(15, 0, 0, 0); } //create the datetime DateTime datetoconvert = Datetime.newInstanceGmt(Date.today(), cuttime); system.debug('----------------------->datetoconvert'+datetoconvert); //Convert it to the local user timezone cutoff = datetoconvert.format('h:mm a', usertz); system.debug('----------------------->cutoff'+cutoff); } }
And here is my Unit Test
@IsTest public with sharing class cut_off_controlerTest { @IsTest(SeeAllData = false) public static void test_cut_off_controllerLondon(){ User user = new User(alias = 'usertst1', email='usertst1' + '@xyz.com', emailencodingkey='UTF-8', lastname='Testing1', languagelocalekey='en_US', localesidkey='en_US', profileid = profile.Id, timezonesidkey='Europe/London', username='user1' + '@xyz.com'); insert user; cut_off_controler coc = new cutt_off_controler(); coc.setcutoff(); } public static void test_cut_off_controllerLondon(){ User user = new User(alias = 'usertst2', email='usertst2' + '@xyz.com', emailencodingkey='UTF-8', lastname='Testing2', languagelocalekey='en_US', localesidkey='en_US', profileid = profile.Id, timezonesidkey='Asia/Shanghai', username='user2' + '@xyz.com'); insert user; cut_off_controler coc = new cutt_off_controler(); coc.setcutoff(); } }
Any help would be very much appreciated.
- saad mechiche alami
- May 12, 2014
- Like
- 0
Javascript Error when escalating Case to Queue
I am currently using the following Javascript Code to assign a case to a queue , by pressing a button called: Escalation to CC I get the attached jpg error message
Here is the code:
OnClick JavaScript {!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")} var caseObj = new sforce.SObject('Case'); caseObj.Id = '{!Case.Id}'; caseObj.OwnerId = '{!$Setup.Agora_settings__c.CC_queue_ID__c}'; caseObj.Status = "Assigned"; var result = sforce.connection.update([caseObj]); window.location.href=window.location.href;
Can you please help , thanks
- saad mechiche alami
- May 06, 2014
- Like
- 0
Trigger field is not Writeable
In the code below I am trying to put a contract owner in the opportunity team record and i want to grand him read/write permission in that record
My issue is that when i try to save that record, I get an error message saying
Error: Compile Error: Field is not writeable: OpportunityTeamMember.OpportunityAccessLevel at line 27 column 1
can you please help, many thanks
trigger OpportunityBeforeUpdate1 on Opportunity (before update) { string oppName; opportunity oppId; SVMXC__Service_Contract__c smc= new SVMXC__Service_Contract__c(); for (opportunity opp: trigger.new) oppName=opp.name; oppId=[select Id, name from opportunity where name=:oppname limit 1]; integer res=oppName.indexof(' - '); String ConName=oppName.left(res); smc=[select name, OwnerId from SVMXC__Service_Contract__c where name=:ConName limit 1]; OpportunityTeamMember oppt = new OpportunityTeamMember(); oppt.OpportunityId=oppId.Id; oppt.userid=smc.ownerid; oppt.OpportunityAccessLevel='edit'; oppt.TeamMemberRole='Service Sales Contributor'; insert oppt; }
- saad mechiche alami
- November 06, 2014
- Like
- 0
User has no access to contact dispite profile and Permission set CRED
I currently have a user that cannot create a contact dispite giving his profile all CRED and assigning him a permission set with CRED on contact
Can you please help.
Many thanks
- saad mechiche alami
- November 04, 2014
- Like
- 0
Javascript to parse fields to Joined Report
Hi,
As a complete Javascript novice, I'm trying to get some assistance here with a script to run a report from a button on the Contracts object that will parse some field data to a joined report. You can't do it with a URL hack, has to be javascript.
Luckily, I have some code to work from, it is rather transparent although I need some help amending it.
My issue is with pulling some information from Salesforce into the script, arrays and such things.
Essentially the code I have ripped is looking to parse one field, I am looking to parse two (a custom field from the Accounts object (sagecode__c for arguments sake) and one from the Contracts object itself (contractnumber__c for arguments sake).
This is the code, it is from the author so does not contain anything pertaining to what I am aiming to do in my own org. The header comments are mine.
// JScript source code // This is a script which parses parameters to a Joined Report as URL hacking will not work in this instance. // Background reading on solution is here: http://salesforce.stackexchange.com/questions/8723/passing-variables-to-joined-reports // This script was sourced from here: https://gist.github.com/stephenbrown1/7443749 // Chrome extention tools to debug the report from here: http://forums.chrispederick.com/ // -- -- -- Click FORMS and VIEW FORM INFORMATION to find the reportJson details for this script after running report. // This site URL encodes the JSON request: http://www.freeformatter.com/url-encoder.html // Code is annotated where you need to make amendments var url = "/00O90000004ewmO"; // report ID var method = "POST"; var idArray = {!GETRECORDIDS($ObjectType.Contract_Partner_vod__c)}; // if the field you want for report critiera isn't avail from the detail record (ie list button) then need to get related data var idToUse = idArray[0]; //alert(idToUse); if (idToUse == null) { // need to have at least 1 record selected alert('You must select one contract partner record to run this report.'); } else { {!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")} result = sforce.connection.query("Select Id, Contract_vod__c from Contract_Partner_vod__c where Id = \'" + idToUse + "\'"); var contrId = null; records = result.getArray("records"); for (var i=0; i< records.length; i++) { var record = records[i]; contrId = record.Contract_vod__c.substring(0,15); } //alert(contrId); // if the field you want for report critiera isn't avail from the detail record (ie list button) then need to get related data - in this case contract ID // next line is post data - needs to be URL encoded. Note this is based on what comes from the runReportJson which you can get from running the report and checking firebug var postData = "op=run&runReportJson=%7B%22last_modified_user_id%22%3A%22005900000022hZg%22%2C%22breaks%22%3A%5B%7B%22brkcol%22%3A%2200N90000007QeT8%22%2C%22break%22%3A%2200N90000007QeT8%22%2C%22sortColumn%22%3A%2200N90000007QeT8%22%2C%22brkord%22%3A%22up%22%2C%22breakLevel%22%3A%220%22%2C%22brkdat%22%3A%220%22%7D%5D%2C%22colorRanges%22%3A%5B%5D%2C%22entity%22%3A%2201I900000018lXc%22%2C%22reln%22%3A%2200N90000007JDQt%22%2C%22currency%22%3A%22000%22%2C%22id%22%3A%2200O90000004ewmO%22%2C%22cust_devName%22%3A%22Contract_Price_List%22%2C%22cust_name%22%3A%22Contract+Price+List%22%2C%22last_modified_by%22%3A%22Paul+Hosking%22%2C%22details%22%3A%22no%22%2C%22reportParams%22%3A%5B%7B%22param%22%3A%22lsk%22%2C%22value%22%3A%221%22%7D%2C%7B%22param%22%3A%22block_id_counter%22%2C%22value%22%3A%226%22%7D%5D%2C%22templateKey%22%3A%2201I900000018lXc00N90000007JDQt%22%2C%22topn%22%3A0%2C%22c%22%3A%5B%5D%2C%22sortdir%22%3A%22down%22%2C%22sideBySide%22%3Afalse%2C%22blocks%22%3A%5B%7B%22templateKey%22%3A%2201I900000018lXc00N90000007JDQt%22%2C%22scope%22%3A%22organization%22%2C%22topn%22%3A0%2C%22c%22%3A%5B%22FK_NAME%22%2C%22CUST_NAME%22%2C%2200N90000007QeUH%22%2C%2200N90000007QeT7%22%5D%2C%22last_modified_user_id%22%3A%22%22%2C%22sideBySide%22%3Afalse%2C%22sortdir%22%3A%22up%22%2C%22breaks%22%3A%5B%5D%2C%22a%22%3A%5B%2200N90000007QeT7%22%2C%2200N90000007QeUH%22%5D%2C%22entity%22%3A%2201I900000018lXc%22%2C%22colorRanges%22%3A%5B%5D%2C%22reln%22%3A%2200N90000007JDQt%22%2C%22format%22%3A%22t%22%2C%22charts%22%3A%5B%7B%22ctsize%22%3A18%2C%22bgdir%22%3A%222%22%2C%22l%22%3A%221%22%2C%22bg2%22%3A16777215%2C%22csize%22%3A3%2C%22bg1%22%3A16777215%2C%22tfg%22%3A0%2C%22ct%22%3A%22none%22%2C%22sal%22%3Atrue%2C%22chco%22%3Atrue%2C%22chsp%22%3Afalse%2C%22cfsize%22%3A12%2C%22cp%22%3A%22b%22%2C%22cheh%22%3Afalse%2C%22fg%22%3A0%2C%22chst%22%3Afalse%2C%22summaries%22%3A%5B%5D%2C%22chsv%22%3Afalse%2C%22Yman%22%3Afalse%7D%5D%2C%22v%22%3A142%2C%22cust_name%22%3A%22Contract+Price+Rule%22%2C%22co%22%3A%22no%22%2C%22last_modified_date%22%3A%22%22%2C%22last_modified_by%22%3A%22%22%2C%22details%22%3A%22no%22%2C%22customAggregates%22%3A%5B%5D%2C%22blkInfo%22%3A%7B%22blkjt%22%3A%22x%22%2C%22blockId%22%3A%22B1%22%2C%22csfReferences%22%3A%5B%22FORMULA1%22%2C%22FORMULA2%22%2C%22FORMULA3%22%2C%22FORMULA4%22%2C%22FORMULA5%22%2C%22FORMULA6%22%2C%22FORMULA7%22%5D%7D%2C%22rt%22%3A%2251%22%2C%22filters%22%3A%5B%7B%22pc%22%3A%22FK_CUSTENT_ID%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22" + contrId + "%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%5D%2C%22reportParams%22%3A%5B%7B%22param%22%3A%22colDt_c%22%2C%22value%22%3A%2200N90000007QeY2%22%7D%2C%7B%22param%22%3A%22colDt_e%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22colDt_q%22%2C%22value%22%3A%22custom%22%7D%2C%7B%22param%22%3A%22colDt_s%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22function%22%2C%22value%22%3A%22c%22%7D%2C%7B%22param%22%3A%22name_op%22%2C%22value%22%3A%22co%22%7D%2C%7B%22param%22%3A%22save_drill%22%2C%22value%22%3A%22true%22%7D%5D%7D%2C%7B%22templateKey%22%3A%2201I900000018lXc%22%2C%22scope%22%3A%22organization%22%2C%22topn%22%3A0%2C%22c%22%3A%5B%22CUST_NAME%22%2C%2200N90000007QeT6%22%5D%2C%22last_modified_user_id%22%3A%22%22%2C%22breaks%22%3A%5B%5D%2C%22sideBySide%22%3Afalse%2C%22sortdir%22%3A%22up%22%2C%22a%22%3A%5B%2200N90000007QeT6%22%5D%2C%22colorRanges%22%3A%5B%5D%2C%22entity%22%3A%2201I900000018lXc%22%2C%22format%22%3A%22t%22%2C%22v%22%3A142%2C%22cust_name%22%3A%22List+Price%22%2C%22charts%22%3A%5B%7B%22ctsize%22%3A18%2C%22bgdir%22%3A%222%22%2C%22l%22%3A%221%22%2C%22bg2%22%3A16777215%2C%22csize%22%3A3%2C%22bg1%22%3A16777215%2C%22tfg%22%3A0%2C%22ct%22%3A%22none%22%2C%22sal%22%3Atrue%2C%22chco%22%3Atrue%2C%22chsp%22%3Afalse%2C%22cfsize%22%3A12%2C%22cp%22%3A%22b%22%2C%22cheh%22%3Afalse%2C%22fg%22%3A0%2C%22chst%22%3Afalse%2C%22summaries%22%3A%5B%5D%2C%22chsv%22%3Afalse%2C%22Yman%22%3Afalse%7D%5D%2C%22last_modified_date%22%3A%22%22%2C%22co%22%3A%22no%22%2C%22last_modified_by%22%3A%22%22%2C%22details%22%3A%22no%22%2C%22customAggregates%22%3A%5B%5D%2C%22blkInfo%22%3A%7B%22blkjt%22%3A%22x%22%2C%22blockId%22%3A%22B0%22%7D%2C%22rt%22%3A%2251%22%2C%22filters%22%3A%5B%7B%22pc%22%3A%22CUST_RECORDTYPE%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22List_Price_Rule_vod%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeUG%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeT2%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeT1%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%5D%2C%22reportParams%22%3A%5B%7B%22param%22%3A%22colDt_c%22%2C%22value%22%3A%2200N90000007QeY2%22%7D%2C%7B%22param%22%3A%22colDt_e%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22colDt_q%22%2C%22value%22%3A%22custom%22%7D%2C%7B%22param%22%3A%22colDt_s%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22function%22%2C%22value%22%3A%22c%22%7D%2C%7B%22param%22%3A%22name_op%22%2C%22value%22%3A%22co%22%7D%5D%7D%2C%7B%22templateKey%22%3A%2201I900000018lXc%22%2C%22scope%22%3A%22organization%22%2C%22topn%22%3A0%2C%22c%22%3A%5B%22CUST_NAME%22%2C%2200N90000007QeUH%22%2C%2200N90000007QeT7%22%5D%2C%22last_modified_user_id%22%3A%22%22%2C%22breaks%22%3A%5B%5D%2C%22sideBySide%22%3Afalse%2C%22sortdir%22%3A%22up%22%2C%22colorRanges%22%3A%5B%5D%2C%22entity%22%3A%2201I900000018lXc%22%2C%22format%22%3A%22t%22%2C%22v%22%3A142%2C%22cust_name%22%3A%22STT+Price%22%2C%22charts%22%3A%5B%7B%22ctsize%22%3A18%2C%22bgdir%22%3A%222%22%2C%22l%22%3A%221%22%2C%22bg2%22%3A16777215%2C%22csize%22%3A3%2C%22bg1%22%3A16777215%2C%22tfg%22%3A0%2C%22ct%22%3A%22none%22%2C%22sal%22%3Atrue%2C%22chco%22%3Atrue%2C%22chsp%22%3Afalse%2C%22cfsize%22%3A12%2C%22cp%22%3A%22b%22%2C%22cheh%22%3Afalse%2C%22fg%22%3A0%2C%22chst%22%3Afalse%2C%22summaries%22%3A%5B%5D%2C%22chsv%22%3Afalse%2C%22Yman%22%3Afalse%7D%5D%2C%22last_modified_date%22%3A%22%22%2C%22co%22%3A%22no%22%2C%22last_modified_by%22%3A%22%22%2C%22details%22%3A%22no%22%2C%22customAggregates%22%3A%5B%5D%2C%22blkInfo%22%3A%7B%22blkjt%22%3A%22x%22%2C%22blockId%22%3A%22B3%22%7D%2C%22rt%22%3A%2251%22%2C%22filters%22%3A%5B%7B%22pc%22%3A%2200N90000007QeT2%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeT1%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007JDQt%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeUG%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeY2%22%2C%22pn%22%3A%22ge%22%2C%22pv%22%3A%22TODAY%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeTC%22%2C%22pn%22%3A%22le%22%2C%22pv%22%3A%22TODAY%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%22CUST_RECORDTYPE%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22Discount_Rule_vod%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%5D%2C%22reportParams%22%3A%5B%7B%22param%22%3A%22colDt_c%22%2C%22value%22%3A%2200N90000007QeY2%22%7D%2C%7B%22param%22%3A%22colDt_e%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22colDt_q%22%2C%22value%22%3A%22custom%22%7D%2C%7B%22param%22%3A%22colDt_s%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22function%22%2C%22value%22%3A%22c%22%7D%2C%7B%22param%22%3A%22name_op%22%2C%22value%22%3A%22co%22%7D%5D%7D%5D%2C%22format%22%3A%22mb%22%2C%22created_by_user_id%22%3A%22005900000022hZg%22%2C%22charts%22%3A%5B%7B%22ctsize%22%3A18%2C%22bgdir%22%3A%222%22%2C%22l%22%3A%221%22%2C%22bg2%22%3A16777215%2C%22csize%22%3A3%2C%22bg1%22%3A16777215%2C%22tfg%22%3A0%2C%22ct%22%3A%22none%22%2C%22sal%22%3Atrue%2C%22chco%22%3Atrue%2C%22chsp%22%3Afalse%2C%22cfsize%22%3A12%2C%22cp%22%3A%22b%22%2C%22cheh%22%3Afalse%2C%22fg%22%3A0%2C%22chst%22%3Afalse%2C%22summaries%22%3A%5B%5D%2C%22chsv%22%3Afalse%2C%22Yman%22%3Afalse%7D%5D%2C%22v%22%3A142%2C%22last_modified_date%22%3A%2214%2F11%2F2013+9%3A49+AM%22%2C%22co%22%3A%22yes%22%2C%22customAggregates%22%3A%5B%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%22%2C%22DataType%22%3A%22N%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22List+Price+List+Price%22%2C%22DeveloperName%22%3A%22FORMULA1%22%2C%22RowBreakContext%22%3A%2200N90000007QeT8%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22B3%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG%22%2C%22DataType%22%3A%22N%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22STT+Disc%22%2C%22DeveloperName%22%3A%22FORMULA2%22%2C%22RowBreakContext%22%3A%2200N90000007QeT8%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22B3%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%22%2C%22DataType%22%3A%22N%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22STT+Net%22%2C%22DeveloperName%22%3A%22FORMULA3%22%2C%22RowBreakContext%22%3A%2200N90000007QeT8%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG+-+%28B3%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG+*+B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%29%22%2C%22DataType%22%3A%22N%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22STT+Disc+Net+Price%22%2C%22DeveloperName%22%3A%22FORMULA4%22%2C%22RowBreakContext%22%3A%2200N90000007QeT8%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG+-+%28B1%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG+*+B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%29%22%2C%22DataType%22%3A%22N%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22Contract+Disc+Net+Price%22%2C%22DeveloperName%22%3A%22FORMULA5%22%2C%22RowBreakContext%22%3A%2200N90000007QeT8%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22IF%28B1%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG%3C%3E0%5Cn%2C+B1%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG%5Cn%2C+IF%28B1%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%3C%3E0%5Cn%2C%28B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG+-+B1%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%29+%2F+B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%5Cn%2CIF%28B3%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG%3C%3E0%5Cn%2CB3%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG%5Cn%2CIF%28B3%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%3C%3E0%5Cn%2C+%28B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG+-+B3%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%29%2FB0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%5Cn%2C0%5Cn%29%29%29%29%22%2C%22DataType%22%3A%22P%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22Final+Discount%22%2C%22DeveloperName%22%3A%22FORMULA6%22%2C%22RowBreakContext%22%3A%2200N90000007QeT8%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22IF%28B1%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG+%3C%3E+0%5Cn%2C+B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG+-%28B1%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG+*+B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%29%5Cn%2C+IF%28B1%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG+%3C%3E+0%5Cn%2CB1%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%5Cn%2CIF%28B3%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG+%3C%3E+0%5Cn%2CB0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG+-+%28B3%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG+*B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%29%5Cn%2CIF%28B3%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG+%3C%3E+0%5Cn%2CB3%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%5Cn%2CB0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%5Cn%29%29%29%29%22%2C%22DataType%22%3A%22C%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22Final+Net%22%2C%22DeveloperName%22%3A%22FORMULA7%22%2C%22Scale%22%3A2%7D%5D%2C%22blkInfo%22%3A%7B%22blkjt%22%3A%22x%22%7D%2C%22rt%22%3A%2251%22%2C%22cust_owner%22%3A%2200D90000000ome4%22%7D&repId=00O90000004ewmO"; // You REALLY want async = true. // Otherwise, it'll block ALL execution waiting for server response. var async = true; var request = new XMLHttpRequest(); // Before we send anything, we first have to say what we will do when the // server responds. This seems backwards (say how we'll respond before we send // the request? huh?), but that's how Javascript works. // This function attached to the XMLHttpRequest "onload" property specifies how // the HTTP response will be handled. request.onload = function () { // Because of javascript's fabulous closure concept, the XMLHttpRequest "request" // object declared above is available in this function even though this function // executes long after the request is sent and long after this function is // instantiated. This fact is CRUCIAL to the workings of XHR in ordinary // applications. // You can get all kinds of information about the HTTP response. var status = request.status; // HTTP response status, e.g., 200 for "200 OK" var data = request.responseText; // Returned data, e.g., an HTML document. var x=window.open().document; x.open(); x.write(data); x.close(); } request.open(method, url, async); request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); // Or... request.setRequestHeader("Content-Type", "text/plain;charset=UTF-8"); // Or... whatever // Actually sends the request to the server. request.send(postData); }I can see what is going on, array is being created, SoQL query executing, value being stored. But there are some elements I am not sure of:
var idArray = {!GETRECORDIDS($ObjectType.Contract_Partner_vod__c)}; // if the field you want for report critiera isn't avail from the detail record (ie list button) then need to get
Unsure of the syntax I use here. I'm obviously to get ID's from an object to use in a query, I just need to know if I'm going to be formatting it correctly. I would ask our Java guys but I think this falls into the realm of Salesforce syntax.
records = result.getArray("records"); for (var i=0; i< records.length; i++) { var record = records[i]; contrId = record.Contract_vod__c.substring(0,15); }
Not sure what this piece of the code is aiming to do either. Is it truncating the 18 character ID? Because if so, I can probably kill this section of code off as I will be purely dealing with strings.
The rest seems relatively straightforward, it looks like I would have to duplicate the code to find my second field to parse. This person is obviously looking for his one custom field to parse to the report, as reflected by the search and result obtained.
Can anyone shed some light here to help me through?
Thanks.
- Simon Whight
- October 09, 2014
- Like
- 0
Error when insterting contentversion in a unit test
I am currently runing a test where i need to query the contentversion object , in my test i have added the following lines :
ContentVersion cv = new ContentVersion(contentdocumentid='069L00000000xEI'); insert cv;
however , when i run my test i get the following error :
Could you please help , many thanks
- saad mechiche alami
- May 15, 2014
- Like
- 0
Create custom settings for a unit test
I need to create a custom setting for my unit test
the custom setting object name is called Terms_of_Use
how can i program that ?
many thanks
- saad mechiche alami
- May 15, 2014
- Like
- 0
Javascript Error when escalating Case to Queue
I am currently using the following Javascript Code to assign a case to a queue , by pressing a button called: Escalation to CC I get the attached jpg error message
Here is the code:
OnClick JavaScript {!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")} var caseObj = new sforce.SObject('Case'); caseObj.Id = '{!Case.Id}'; caseObj.OwnerId = '{!$Setup.Agora_settings__c.CC_queue_ID__c}'; caseObj.Status = "Assigned"; var result = sforce.connection.update([caseObj]); window.location.href=window.location.href;
Can you please help , thanks
- saad mechiche alami
- May 06, 2014
- Like
- 0