• Pat McQueen
  • NEWBIE
  • 30 Points
  • Member since 2006

  • Chatter
    Feed
  • 1
    Best Answers
  • 4
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 47
    Replies

Hi, I'm new to apex.  I was wondering if there is way to use an apex trigger to change the way Salesforce amortizes revenue.  For example, if an opportunity product revenue is entered for $6800 for a 12 month period, it will automatically allocate $566.00 for each month, and load the remainder in the 12th month.  However, what I would prefer is that its broken down evenly with decimals as $566.66 for the first 11 months, and the final month gets the extra change ($566.74).

 

Would this be possible to achieve with an apex trigger?  Any assistance on this matter is greatly appreciated.

Hello - I am trying to do a multiple child record create with NGForce.  There is a validation rule on the object.  The problem I have is that when the validation rule stops the insert that I can't seem to capture the error and show the end user why the insert failed.  I tried a basic alert(error.message); and it gives me "Error object undefined"  The code works ... As long as the data entry is perfect.  How do I catch a failure and show the error message to the end user?  All I can show now is a generic "The insert has failed with an error"
 
$scope.createAttend = function(student, rowColor){

                var attendRecord = {Scholarship__c : student.Id ,Possible_Days_in_Attendance__c : this.possibleDays , Days_in_Attendance__c : student.totalAttendance, Excused_Absences__c : student.Excused, Check_in_Date__c : this.checkInDate, Notes__c : student.Notes}
              
               vfr.create("Scholarship_Student_Attendance__c",JSON.stringify(attendRecord)).then(
                
                function(response){
                     $filter('filter')($scope.students, {Id : student.Id})[0].wstate = rowColor;                             
                },
                function (error){
                    alert("The insert has failed with an error."); 
                    console.log(error);
                }
            )
           }

 

Salesforce1 has a great Today page which shows the users calendar mashed up with salesforce.com. It works well when the user is not using Salesforce as their primary calendar.  However many want to use Salesforce as the primary calendar.  So - How then do you display a calendar in Salesforce1?

 

This is a hack - but an easy one which works!  Here is how to add a Salesforce calendar to Salesforce1:

 

1) Create a visualforce page "My Calendar"  Be sure to make the page available for salesforce mobile apps.  The content of the page should be:

 

<apex:page showHeader="false" sidebar="false" >

<div style="overflow:scroll; width:100%; height:100%;">
    <object type="text/html" data="https://na2.salesforce.com/00U/c?isdtp=mn"
            style="overflow:scroll; width:1200px; height:2400px;">
    </object>
</div>

</apex:page>

 

2) Add a VisualForce tab for the visualforce page called my calendar.  Ensure the users can access the tab but make it hidden.  Does not need to be mobile ready as that setting is for the Classic Mobile app.

3) Under Mobile Administration / Moble Navigation add the "My Calendar" Visualforce tab to the selected Navigation menu item.

4) Login to Salesforce1 and celebrate your job well done!

 

I hope you find this as useful as I did.

 

 

 

We are building a Visualforce page that will work with Salesforce.com mobile on the iPhone.  Our users are going to be in rural and remote areas so we need a VERY light visualforce page.  Right now when we build a VF page with this code it produces includes to three or more JavaScript files and makes the download of the page REALLY slow over low bandwidth.  

 

 

<apex:page controller="CreateOrder" showheader="false" sidebar="false" standardStylesheets="false" action="{!checkPermission}">
<!DOCTYPE HTML>
<meta content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>

 What can I do to eliminate much of the JavaScript to make the page lighter?  Here is what results from the pages above.

 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
<!DOCTYPE HTML>
<html><head><script src="/faces/a4j/g/3_3_0.GAorg.ajax4jsf.javascript.AjaxScript" type="text/javascript"></script><script src="/static/060710/js/functions.js" type="text/javascript"></script><script src="/jslibrary/1281554859000/main.js"></script><script src="/jslibrary/labels/1284058836000/en_US.js" type="text/javascript"></script><script src="/static/060710/desktop/desktopAjax.js" type="text/javascript"></script></head>
<meta content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>

 

 

Thanks for any ideas!

 

Pat

 

 

Hello,

 

I am creating a trigger on OpportunityLineItem which will create a revenue schedule.  I am not using the out of box revenue scheduling as it does not create a schedule that fits my business needs. I created the trigger below which works fine, but I can't seem to make it work in bulk.  I put the test methods below as well.  The test methods work with a bulk insert of 5 rows but anything more gives me an exception. (when bi is greater than 5 in the test method it fails)  Any ideas why I can't make this more bulk enabled?  Thanks - Pat

 

Exception for larger bulk inserts

 

20090413174655.805:Class.ProductScheduleTriggerTest.myUnitTest: line 105, column 9: DML Operation executed in 240 ms System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ProductScheduleTriggerBulk: execution of AfterInsert caused by: System.Exception: Too many DML rows: 156 Trigger.ProductScheduleTriggerBulk: line 100, column 9 Class.ProductScheduleTriggerTest.myUnitTest: line 105, column 9

 

 

 

Trigger

 

// // This trigger requires two custom fields and a validation rule. // trigger ProductScheduleTriggerBulk on OpportunityLineItem (after insert) { // // Get prepped by retrieving the base information needed // Date currentDate; Decimal numberPayments; Decimal paymentAmount; Decimal totalPaid; List<OpportunityLineItemSchedule> newScheduleObjects = new List<OpportunityLineItemSchedule>(); // For every OpportunityLineItem record, add its associated pricebook entry // to a set so there are no duplicates. Set<Id> pbeIds = new Set<Id>(); for (OpportunityLineItem oli : Trigger.new) pbeIds.add(oli.pricebookentryid); // Query the PricebookEntries for their associated info and place the results // in a map. Map<Id, PricebookEntry> entries = new Map<Id, PricebookEntry>( [select product2.Auto_Schedule_Revenue__c, product2.Num_Payments__c from pricebookentry where id in :pbeIds]); // For every OpportunityLineItem record, add its associated oppty // to a set so there are no duplicates. Set<Id> opptyIds = new Set<Id>(); for (OpportunityLineItem oli : Trigger.new) opptyIds.add(oli.OpportunityId); // Query the Opportunities for their associated info and place the results // in a map. Map<Id, Opportunity> Opptys = new Map<Id, Opportunity>( [select Id, CloseDate from Opportunity where id in :opptyIds]); // Iterate through the changes for (OpportunityLineItem item : trigger.new) { if(entries.get(item.pricebookEntryID).product2.Auto_Schedule_Revenue__c == true) { //OK, we have an item that needs to be Auto Scheduled //Calculate the payment amount paymentAmount = item.TotalPrice; numberPayments = (entries.get(item.pricebookEntryId).product2.Num_Payments__c); paymentAmount = paymentAmount.divide(numberPayments,2); //System.debug('* * * * Base Monthly Amount = ' + paymentAmount); // Determine which date to use as the start date. if (item.ServiceDate == NULL) { currentDate = Opptys.get(item.OpportunityId).CloseDate; } else { currentDate = item.ServiceDate; } totalPaid = 0; // Loop though the payments for (Integer i = 1;i < numberPayments;i++) { OpportunityLineItemSchedule s = new OpportunityLineItemSchedule(); s.Revenue = paymentAmount; s.ScheduleDate = currentDate; s.OpportunityLineItemId = item.id; s.Type = 'Revenue'; newScheduleObjects.add(s); totalPaid = totalPaid + paymentAmount; System.debug('********Date ' + currentDate + ' Amount ' + paymentAmount); currentDate = currentDate.addMonths(1); } //Now Calulate the last payment! paymentAmount = item.TotalPrice - totalPaid; OpportunityLineItemSchedule s = new OpportunityLineItemSchedule(); s.Revenue = paymentAmount; s.ScheduleDate = currentDate; s.OpportunityLineItemId = item.id; s.Type = 'Revenue'; newScheduleObjects.add(s); System.debug('********** LAST PAYMENT **********'); System.debug('********Date ' + currentDate + ' Amount ' + paymentAmount); } // End If Auto_Schedule_Revenue } // End For OpportunityLineItem try { insert(newScheduleObjects); } catch (System.DmlException e) { for (Integer ei = 0; ei < e.getNumDml(); ei++) { System.debug(e.getDmlMessage(ei)); } // // There shuld be something here to alert the user what failed! // } // End Catch } // End Trigger ProducScheduleTriggerBulk

 

 

 

Test Method

 

/** * This class tests the trigger named ProductScheduleTrigger. */ @isTest private class ProductScheduleTriggerTest { static testMethod void myUnitTest() { //Data Prep //Create Account, Opportunity, Product, etc. Account acct1 = new Account(name='test Account One1'); insert acct1; //Create Opportunity on Account Opportunity Oppty1 = new Opportunity(name='test Oppty One1'); Oppty1.StageName = 'Test'; Oppty1.CloseDate = Date.today(); insert Oppty1; // Create Products Product2 testprod1 = new Product2 (name='test product one1'); testprod1.productcode = 'test pd code1one'; testprod1.Num_Payments__c = 0; testprod1.CanUseRevenueSchedule = True; testprod1.Auto_Schedule_Revenue__c = False; insert testprod1; Product2 testprod2 = new Product2 (name='test product two2'); testprod2.productcode = 'test pd code2two'; testprod2.Num_Payments__c = 12; testprod2.CanUseRevenueSchedule = True; testprod2.Auto_Schedule_Revenue__c = True; insert testprod2; // Ger Pricebook Pricebook2 testpb = [select id from Pricebook2 where IsStandard = true]; // Add to pricebook PricebookEntry testpbe1 = new PricebookEntry (); testpbe1.pricebook2id = testpb.id; testpbe1.product2id = testprod1.id; testpbe1.IsActive = True; testpbe1.UnitPrice = 250; testpbe1.UseStandardPrice = false; insert testpbe1; PricebookEntry testpbe2 = new PricebookEntry (); testpbe2.pricebook2id = testpb.id; testpbe2.product2id = testprod2.id; testpbe2.IsActive = True; testpbe2.UnitPrice = 250; testpbe2.UseStandardPrice = false; insert testpbe2; //And now you want execute the startTest method to set the context //of the following apex methods as separate from the previous data //preparation or DML statements. test.starttest(); // add the line item which should call the trigger // with this line item it should fail out quickly // As Auto Schedule is false OpportunityLineItem oli1 = new OpportunityLineItem(); oli1.Quantity = 1; oli1.TotalPrice = 1; oli1.PricebookEntryId = testpbe1.id; oli1.OpportunityId = oppty1.id; insert oli1; System.assertEquals(0, [select count() from OpportunityLineItemSchedule where OpportunityLineItemId = :oli1.id]); // add the line item which should call the trigger // Auto Schedule is true so it should build the schedule. OpportunityLineItem oli2 = new OpportunityLineItem(); oli2.Quantity = 1; oli2.TotalPrice = 1; oli2.PricebookEntryId = testpbe2.id; oli2.OpportunityId = oppty1.id; insert oli2; System.assertEquals(12, [select count() from OpportunityLineItemSchedule where OpportunityLineItemId = :oli2.id]); // add the line item which should call the trigger // Auto Schedule is true so it should build the schedule. // This uses a date on OpptyLineItem to try another code path OpportunityLineItem oli3 = new OpportunityLineItem(); oli3.Quantity = 1; oli3.TotalPrice = 1; oli3.ServiceDate = date.today(); oli3.PriceBookEntryId = testpbe2.id; oli3.OpportunityId = oppty1.id; insert oli3; System.assertEquals(12, [select count() from OpportunityLineItemSchedule where OpportunityLineItemId = :oli3.id]); // Adding multiple line items in bulk which should call the trigger. // Auto Schedule is true so it should build the schedule. // This trigger does not work in large bulk amounts as it adds multiple rows. List<OpportunityLineItem> bulkoli = new List<OpportunityLineItem>(); for(integer bi=0; bi<5; bi++) { bulkoli.add( new OpportunityLineItem(Quantity = 1, TotalPrice = 1, PriceBookEntryId = testpbe2.id, OpportunityId = Oppty1.id) ); } insert bulkoli; System.assertEquals(12*5, [select count() from OpportunityLineItemSchedule where OpportunityLineItemId in :bulkoli]); test.stoptest(); } }

 

 

 

Hello,

I am using a component in a VF page and trying to pass information to the custom controller of the component and not having any luck.  I think I am missing something basic ... But can't seem to figure it out.  There are three parts - The VF page, Component and Controller.  When I run the VF page the Apex Debug log confirms that the TargetUserID: is not passed to the custom controller.  I thought that the apex:attribute tag with the assign to would call the setter for Target User ID.  Any assistance would be appreciated.

The code does run.  It just evaluates the TargetUserID as null and returns all the "null" booth shifts - I would like the target users' shifts.

pat

VF Page Code:
<apex:page >
<h1>Start</h1>
<c:BoothShiftList TargetUserID="00580000001UipR" />
</apex:page>

Custom Component <BoothShiftList> Code:
<apex:component controller="ScheduleEmailController">
<apex:attribute name="TargetUserID" description="User id of the person getting this page" type="string" required="true" assignTo="{!TargetUserID}"/>
<apex:pageBlock title="My Dreamforce Shifts">
<apex:pageBlockTable id="shifttable" value="{!bs}" var="currentBooth">
<apex:column headerValue="Shift Time">
<a href="/{!currentBooth.Id}">{!currentBooth.Shift__r.name}</a>
</apex:column>
<apex:column headerValue="Booth Name">
<a href="/{!currentBooth.Booth__r.Id}">{!currentBooth.Booth__r.Booth__c}</a>
</apex:column>
<apex:column headerValue="Add to Calendar">
<a href="/{!currentBooth.Id}">{!currentBooth.Assigned__c} - {!currentBooth.Is_this_Staffed__c}</a>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:component>

 
Custom Controller Code:
Public class ScheduleEmailController {

    public string TargetUserID { get; set; }
    public Booth_Shift__c[] bs { get; set; }

    public ScheduleEmailController()
    {    
        bs = [Select assigned__r.Id, b.Shift__r.Date__c, b.Shift__r.name, b.Shift__r.Shift_Time__c, b.Shift__c, 
            b.Booth__r.Booth_Type__c, b.Booth__r.Booth__c, b.Booth__c, b.Is_this_Staffed__c from Booth_Shift__c b
            where assigned__r.Id = :TargetUserID order by b.Shift__r.start__c LIMIT 10];
            
            System.debug('Current User: ' + UserInfo.getUserName());
            System.debug('TargetUserID: ' + TargetUserID);
    }
}

 

 

Salesforce1 has a great Today page which shows the users calendar mashed up with salesforce.com. It works well when the user is not using Salesforce as their primary calendar.  However many want to use Salesforce as the primary calendar.  So - How then do you display a calendar in Salesforce1?

 

This is a hack - but an easy one which works!  Here is how to add a Salesforce calendar to Salesforce1:

 

1) Create a visualforce page "My Calendar"  Be sure to make the page available for salesforce mobile apps.  The content of the page should be:

 

<apex:page showHeader="false" sidebar="false" >

<div style="overflow:scroll; width:100%; height:100%;">
    <object type="text/html" data="https://na2.salesforce.com/00U/c?isdtp=mn"
            style="overflow:scroll; width:1200px; height:2400px;">
    </object>
</div>

</apex:page>

 

2) Add a VisualForce tab for the visualforce page called my calendar.  Ensure the users can access the tab but make it hidden.  Does not need to be mobile ready as that setting is for the Classic Mobile app.

3) Under Mobile Administration / Moble Navigation add the "My Calendar" Visualforce tab to the selected Navigation menu item.

4) Login to Salesforce1 and celebrate your job well done!

 

I hope you find this as useful as I did.

 

 

 

Hello - I am trying to do a multiple child record create with NGForce.  There is a validation rule on the object.  The problem I have is that when the validation rule stops the insert that I can't seem to capture the error and show the end user why the insert failed.  I tried a basic alert(error.message); and it gives me "Error object undefined"  The code works ... As long as the data entry is perfect.  How do I catch a failure and show the error message to the end user?  All I can show now is a generic "The insert has failed with an error"
 
$scope.createAttend = function(student, rowColor){

                var attendRecord = {Scholarship__c : student.Id ,Possible_Days_in_Attendance__c : this.possibleDays , Days_in_Attendance__c : student.totalAttendance, Excused_Absences__c : student.Excused, Check_in_Date__c : this.checkInDate, Notes__c : student.Notes}
              
               vfr.create("Scholarship_Student_Attendance__c",JSON.stringify(attendRecord)).then(
                
                function(response){
                     $filter('filter')($scope.students, {Id : student.Id})[0].wstate = rowColor;                             
                },
                function (error){
                    alert("The insert has failed with an error."); 
                    console.log(error);
                }
            )
           }

 

Salesforce1 has a great Today page which shows the users calendar mashed up with salesforce.com. It works well when the user is not using Salesforce as their primary calendar.  However many want to use Salesforce as the primary calendar.  So - How then do you display a calendar in Salesforce1?

 

This is a hack - but an easy one which works!  Here is how to add a Salesforce calendar to Salesforce1:

 

1) Create a visualforce page "My Calendar"  Be sure to make the page available for salesforce mobile apps.  The content of the page should be:

 

<apex:page showHeader="false" sidebar="false" >

<div style="overflow:scroll; width:100%; height:100%;">
    <object type="text/html" data="https://na2.salesforce.com/00U/c?isdtp=mn"
            style="overflow:scroll; width:1200px; height:2400px;">
    </object>
</div>

</apex:page>

 

2) Add a VisualForce tab for the visualforce page called my calendar.  Ensure the users can access the tab but make it hidden.  Does not need to be mobile ready as that setting is for the Classic Mobile app.

3) Under Mobile Administration / Moble Navigation add the "My Calendar" Visualforce tab to the selected Navigation menu item.

4) Login to Salesforce1 and celebrate your job well done!

 

I hope you find this as useful as I did.

 

 

 

I am trying to call my internal url , for these i am generating CA-certificate in salesforce.

My  question is do i need to get authorize by third party vendor while i was using only for my internal API.

  • July 14, 2011
  • Like
  • 0

My  question is do i need to get authorize by third party vendor while i was using only for my internal API.

I am trying to call my internal url , for these i am generating CA-certificate in salesforce.

  • July 14, 2011
  • Like
  • 0

I run multiple orgs and am centralized support in one org for the users of all the other orgs. Rather than burden them with signing into the Self-Service Portal to view their Cases, I'm considering how best to link them to it seamelessly after they have already signed into their home org. SSO is out, we have no network. oAuth might work if the SSP could sign them in using their User credentials, however I'm most inclined to pass their credentials via POST from within Salesforce.

 

Any better ideas? Any stringent objections?

Hi, I'm new to apex.  I was wondering if there is way to use an apex trigger to change the way Salesforce amortizes revenue.  For example, if an opportunity product revenue is entered for $6800 for a 12 month period, it will automatically allocate $566.00 for each month, and load the remainder in the 12th month.  However, what I would prefer is that its broken down evenly with decimals as $566.66 for the first 11 months, and the final month gets the extra change ($566.74).

 

Would this be possible to achieve with an apex trigger?  Any assistance on this matter is greatly appreciated.

Hi,

 

I am supposed to integrate salesforce with Oracle and i have no idea how this can be done, but reading through blogs i was able to figure out certain things, This is what i have thought about and i am doing presently. i am pushing in data from salesforce to SQL tables using a middleware called Apatar, this is wworking fine but later on i dont know how to get the data in Oracle application does any one know this who can help me out? or writing API's is only the method can any one help me out.  Any freelancer or on paid basis:

 

This is what is supposed to go into Oracle when the order is closed:

The following data should be pushed in from Salesforce to Oracle:

 

When the user changes an opportunity to “Order Won” the following details should be pushed in a sequential manner from Salesforce to Oracle:

1)      The Oracle system should check if the particular customer is present in Oracle or else create a new customer.

2)      The Oracle system should check if the particular contact is present in Oracle or else create a new one.

3)      The Quote/Opportunity details from salesforce (Information required in Oracle to process the Sales Order). Example: Branch, SalesOrder Number, Segment, Customer Profile, P.O Number Etc.

4)      The related line items (Products) with their respective basic price and tax structure.

5)      Post sending if there are any changes in the related Quote/Line Item then the same should be appended in Oracle system

 

Oracle To Salesforce:

Once the order is processed then the invoice number and date should be pushed from Oracle to salesforce.



 

Appreciate your help.

Hi Folks,

 

We're trying to intergrate SFDC with an external system via outbound message, as a security measure I have asked the external system team to lock down their client to only receive message from:

 

 204.14.232.0/21

 96.43.144.0/20

 

the security team on the external system requested a narrower range, as they don't normally open accesses to such broad range of IP addresses.

 

Is there a way to know the exact(or narrower range) IP address of my organization (both for sandbox and production)?  and secondly is there a risk that this IP range (if there is even a way to find that out in the first place) changes over time?

 

Thanks,

Sunny_Slp



Hello,

            I have some issues while building jstree with salesforce. i have attached following files in the the static resource.

 

 

<apex:stylesheet value="{!URLFOR($Resource.TreeJsAndStyle, 'jquery/themes/default/style.css')}"/>
     <apex:stylesheet value="{!URLFOR($Resource.TreeJsAndStyle, 'jquery/themes/apple/style.css')}"/>  
     <apex:stylesheet value="{!URLFOR($Resource.TreeJsAndStyle, 'jquery/themes/classic/style.css')}"/>  
     <apex:stylesheet value="{!URLFOR($Resource.TreeJsAndStyle, 'jquery/themes/default-rtl/style.css')}"/>       
     
    
     <apex:includeScript value="{!URLFOR($Resource.TreeJsAndStyle, 'jquery/jquery.cookie.js')}"/>
     <apex:includeScript value="{!URLFOR($Resource.TreeJsAndStyle, 'jquery/jquery.hotkeys.js')}"/>
     <apex:includeScript value="{!URLFOR($Resource.TreeJsAndStyle, 'jquery/jquery.js')}"/>
     <apex:includeScript value="{!URLFOR($Resource.TreeJsAndStyle, 'jquery/jquery.jstree.js')}"/>
     <apex:includeScript value="{!$Resource.treejs}"/>

 

 

i have written following code for that but it is not working and giving me javascript error that jstree is not  a function.here is the javascript code given below.

 

  <!--  jquery for activity tree -->
        var selectedActivityName = '';
    	var $jq  = jQuery.noConflict();
    	
			function createRootActivity() {
				nd = $jq("#demo").jstree('get_selected');
				$jq("#demo").jstree("create",-1,false,"No rename",false,false);
			}
			
			//NOT USED AS OF NOW
			function createActivity(e) {
				$jq("#demo").jstree("create"); 
			}
			
			//NOT USED AS OF NOW
			function renameActivity(e) {
				$jq("#demo").jstree("rename"); 
			}
			
			function setSelectedActivity(selActivityName) {
				selectedActivityName = selActivityName;
			}
			
			var newActivitParentName = '';
			function setNewActivityParentName(parentActName) {
				newActivitParentName = parentActName;
			}
			
			var newActivityName = '';
			function setActivityNewName(newName) {
				//alert('newName:'+newName);
				newActivityName = newName;
			}
		
			$jq(function () {
				$jq("#create_1").click(createRootActivity);
				//$jq("#create_2").click(createActivity);
				//$jq("#rename").click(renameActivity);
				
			});
			
			var activityMoved = '';
			var newActivityPosition = '';
			var newActivityParent = '';
			var keepOriginalActivity = '';
			function changePositionOfActivity(activityName,newPosition,newParentAcitivityName, keepOrigNode) {
				//alert("activityName:"+activityName);
				//alert("newPosition:"+newPosition);
				//alert("newParentAcitivityName:"+newParentAcitivityName);
				//alert("keepOrigNode:"+keepOrigNode);
				
				activityMoved = activityName;
				newActivityPosition = newPosition;
				newActivityParent = newParentAcitivityName;
				keepOriginalActivity = keepOrigNode;
			}
		
			$jq(function () {
			    $jq("#demo")
			    .bind("open_node.jstree create_node.jstree close_node.jstree select_node.jstree move_node.jstree rename_node.jstree cut_node.jstree", function (e, data) {
					if(e.type == 'create_node') {
						movObject = data.args[0];
						setNewActivityParentName($jq("#demo").jstree("get_text",movObject));
					}
				    if(e.type == 'move_node') {
						movObject = data.args[0];
						var keepOrigNode = false;
						if(data.args[3]) {keepOrigNode=true;}
						changePositionOfActivity(movObject.o.text(),movObject.cp,$jq("#demo").jstree("get_text",movObject.np),keepOrigNode);
					}
					if(e.type == 'select_node') {
						setSelectedActivity($jq("#demo").jstree("get_text",data.inst.get_selected()));
					}
					if(e.type == 'rename_node') {
						alert("node renamed");
						movObject = data.args[0];
						setActivityNewName($("#demo").jstree("get_text",movObject));
					}
			    })
			        
			    .jstree({
			        "core" : { "initially_open" : [ "root" ] },
			        
			        "html_data" : {
			            "data" : "<ul><li id='rhtml_1'><a href='#'>Root node 1</a><ul><li id='rhtml_2'><a href='#'>Child node 1</a></li><li id='rhtml_3'><a href='#'>Child node 2</a></li><li id='rhtml_4'><a href='#'>Child node 3</a></li><li id='rhtml_5'><a href='#'>Child node 4</a></li></ul></li><li id='rhtml_6'><a href='#'>Root node 2</a></li><li id='rhtml_7'><a href='#'>Root node 3</a></li></ul>"
		
			    	},
			    	"dnd" : {
				    	"drop_finish" : function () {
			                alert("DROP");
			            },
			            "drag_finish" : function (data) {
			                alert("DRAG OK");
			                alert(data.r);
			            },
			    	},
			    	"ui" : {
			            "select_limit" : 1
			        },
			        "contextmenu" : {
				        	"select_node"		: true,
							"show_at_node"		: false,
							"rename" : {
								"label"				: "Rename",
								// The function to execute upon a click
								"action"			: function (obj) { alert('1');this.rename(obj); },
								// All below are optional 
								"_disabled"			: false,		// clicking the item won't do a thing
								"_class"			: "class",	// class is applied to the item LI node
								"separator_before"	: false,	// Insert a separator before the item
								"separator_after"	: true,		// Insert a separator after the item
								// false or string - if does not contain `/` - used as classname
								"icon"				: true,
								"submenu"			: { 
									/* Collection of objects (the same structure) */
								}
							}
						},
			        "plugins" : [ "themes", "html_data", "dnd", "ui", "crrm","contextmenu" ]
			    });
			});

 

 

and page code is given below.

 

 

<apex:outputPanel id="outPanel" >
                                            	<div id="demo" class="demo"></div>   
                                            </apex:outputPanel>

 

if anyone has any idea pleas tell me.

 

 

Hi, we're looking to build a native application on iOS that links to sfdc to centralize all the data, do analytics, etc...

 

However, I'm not sure whether we should build the native app first and then link it to sfdc through api.  The advantage here is that I have complete control over the app and my own company branding on top of it, but negative is losing a lot of the effort sfdc has put into the sfdc mobile app such as developing all the scripts, managing the interface mapping the 2 systems together, dashboards, report, etc.. that's all already there and we'd need to build from scratch.

 

The other alternative is buidling visualforce pages on top of the current sfdc mobile but there seems to be some offline limitations there, while also not being able to control certain parts of the app like camera access and other iphone functions, and most importantly the customer has to download "Salesforcce Mobile" from appstore which just doesn't make a lot of sense if it's our own custom built application.

 

Both sides have obvious beneifts and drawbacks and I was hoping somebody here has some experience or guidance in this area which would be very helpful.  I can see there are some tracks at Dreamforce that address this but I was hoping to get some more clarity before then. Thanks.

 

Derek

  • September 28, 2010
  • Like
  • 0

We are building a Visualforce page that will work with Salesforce.com mobile on the iPhone.  Our users are going to be in rural and remote areas so we need a VERY light visualforce page.  Right now when we build a VF page with this code it produces includes to three or more JavaScript files and makes the download of the page REALLY slow over low bandwidth.  

 

 

<apex:page controller="CreateOrder" showheader="false" sidebar="false" standardStylesheets="false" action="{!checkPermission}">
<!DOCTYPE HTML>
<meta content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>

 What can I do to eliminate much of the JavaScript to make the page lighter?  Here is what results from the pages above.

 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
<!DOCTYPE HTML>
<html><head><script src="/faces/a4j/g/3_3_0.GAorg.ajax4jsf.javascript.AjaxScript" type="text/javascript"></script><script src="/static/060710/js/functions.js" type="text/javascript"></script><script src="/jslibrary/1281554859000/main.js"></script><script src="/jslibrary/labels/1284058836000/en_US.js" type="text/javascript"></script><script src="/static/060710/desktop/desktopAjax.js" type="text/javascript"></script></head>
<meta content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>

 

 

Thanks for any ideas!

 

Pat

 

 

We are looking for creating applications in salesforce that shows GIS maps of ESRI by passing salesforce object data/query, wonders if anyone has ever done this earlier, and is 'feasible'.

Appreciate any samples of projects/code.

 

Thanks

 

Mel

  • March 01, 2010
  • Like
  • 0