• AlbertoEmpaua
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hi everybody,
I have the following situation, We have in our org a JS button in the layout that call a method in an apex class to send an Email. But in salesforce1 this doesnt works then what I did is create a VF with the same code as the button and calling this VF with a custom Action. Now in Salesforce1 I can see the action but the only thing that do this action is open a blank page with the name of the VF and the buttons cancel and save but doesn't execute the class.
The code in the VF page is:
<apex:page standardController="Invoice__c">
	<apex:includeScript value="/soap/ajax/15.0/connection.js"/>
	<apex:includeScript value="/soap/ajax/15.0/apex.js"/>
	<script>
	
		var result = sforce.apex.execute('sendInvoice', 'send',{invoiceId:'{!Invoice__c.Id}'}); 
	
		if(result == ''){ 
			window.location.reload(); 
	
		}else{ 
			alert(result); 
		}
	</script>
</apex:page>
and the class is:
global with sharing class sendInvoice {
	
	webservice static String send(ID invoiceId) {
		
		Invoice__c inv = [Select Id, Status__c From Invoice__c Where Id =:invoiceId];
		
		if(inv != null && inv.Status__c =='Approved'){
			try {
				//....More code here
				return '';
			} catch(Exception e) {
				System.debug('@@@@ Error: ' + e);
				return 'Unexpected error, please contact with your Administrator';
			}	
		}else{
			return 'Invoice status should be Approved';
		}
	}
    
}
In salesforce classic this works fine but in Salesforce1 I can't find a solution.
Anyone can help me with this??

Thanks

 
Hi everybody,
I have the following situation, We have in our org a JS button in the layout that call a method in an apex class to send an Email. But in salesforce1 this doesnt works then what I did is create a VF with the same code as the button and calling this VF with a custom Action. Now in Salesforce1 I can see the action but the only thing that do this action is open a blank page with the name of the VF and the buttons cancel and save but doesn't execute the class.
The code in the VF page is:
<apex:page standardController="Invoice__c">
	<apex:includeScript value="/soap/ajax/15.0/connection.js"/>
	<apex:includeScript value="/soap/ajax/15.0/apex.js"/>
	<script>
	
		var result = sforce.apex.execute('sendInvoice', 'send',{invoiceId:'{!Invoice__c.Id}'}); 
	
		if(result == ''){ 
			window.location.reload(); 
	
		}else{ 
			alert(result); 
		}
	</script>
</apex:page>
and the class is:
global with sharing class sendInvoice {
	
	webservice static String send(ID invoiceId) {
		
		Invoice__c inv = [Select Id, Status__c From Invoice__c Where Id =:invoiceId];
		
		if(inv != null && inv.Status__c =='Approved'){
			try {
				//....More code here
				return '';
			} catch(Exception e) {
				System.debug('@@@@ Error: ' + e);
				return 'Unexpected error, please contact with your Administrator';
			}	
		}else{
			return 'Invoice status should be Approved';
		}
	}
    
}
In salesforce classic this works fine but in Salesforce1 I can't find a solution.
Anyone can help me with this??

Thanks

 

Hey Guys,

 

I was playing around with DHTMLX Scheduler today and could not get it to render. All I get is a blank page. I checked the JS and CSS References, and everything seems to be in order, The resources are accessed correctly. 

Has anyone attempted this before ?

 

Here is the code I used.

 

<apex:page>
  <apex:form id="theForm">
     <apex:includeScript value="{!URLFOR($Resource.dhtmlxScheduler, 'dhtmlxScheduler/codebase/dhtmlxscheduler.js')}"  />
     <apex:stylesheet value="{!URLFOR($Resource.dhtmlxScheduler, 'dhtmlxScheduler/codebase/dhtmlxscheduler.css')}"/>
	
    <script type="text/javascript" charset="utf-8">
	function initz() {
		
		scheduler.config.multi_day = true;
		
		scheduler.config.xml_date="%Y-%m-%d %H:%i";
		scheduler.init('scheduler_here',new Date(2010,0,10),"week");
		scheduler.load("{!URLFOR($Resource.dhtmlxScheduler, 'dhtmlxScheduler/samples/01_initialization_loading/data/events.xml')}");
		
	}
</script>
<body onload="initz();">
	<div id="scheduler_here" class="dhx_cal_container" style='width:100%; height:100%;'>
		<div class="dhx_cal_navline">
			<div class="dhx_cal_prev_button">&nbsp;</div>
			<div class="dhx_cal_next_button">&nbsp;</div>
			<div class="dhx_cal_today_button"></div>
			<div class="dhx_cal_date"></div>
			<div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
			<div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>
			<div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>
		</div>
		<div class="dhx_cal_header">
		</div>
		<div class="dhx_cal_data">
		</div>
	</div>
</body>
    
    </apex:form>
</apex:page>

 Many Thanks in advance.

 

-Gunish