Guest User

Untitled

a guest
Feb 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. var visit_form_filter = '';
  2. window.formyoula.form_fields["e838-d8cd-04b4"].on("change", function(e){
  3. if(this.get("value")){
  4. visit_form_filter = "Visit__c = '" + window.formyoula.form_fields["e838-d8cd-04b4"].get("value") + "'";
  5. window.formyoula.form_fields["5d08-df52-e0bd"].set("sfdc_filter_fields", visit_form_filter);
  6. }
  7. });
  8.  
  9. function process_Section_Order(){
  10. var header_Text = '';
  11. var parent_Component_Id_href = '';
  12. $('.panel.panel-default.existing_repeat_entry_panel').sort(function (a, b) {
  13. return $(a).find('#component-c3fa-e967-e44d .form-control.input_content.c3fa-e967-e44d').val() - $(b).find('#component-c3fa-e967-e44d .form-control.input_content.c3fa-e967-e44d').val();
  14. }).each(function (_, container) {
  15. var component_Id_href = $(container).find(".panel-heading").attr('href');
  16. var component_Id = component_Id_href.substring(1);
  17. var selectList = $(component_Id_href).find('#component-ad62-b551-da2f .input_content.form-control');
  18. var individual_Question_Picklist_Value = $(component_Id_href+" #component-5177-493d-9b00 .input_content").val() ? ($(component_Id_href+" #component-5177-493d-9b00 .input_content").val().split(',')) : '';
  19. $(selectList).empty();
  20. $(selectList).append($("<option></option>").attr("value",'').text('-- None --'));
  21. $.each(individual_Question_Picklist_Value, function(key, value) {
  22. $(selectList)
  23. .append($("<option></option>")
  24. .attr("value",value)
  25. .text(value));
  26. });
  27.  
  28. $("a[href='" + component_Id_href + "']").get(0).innerText = $(component_Id_href+" #component-fe80-fcbc-17df .input_content").val()
  29. if(header_Text != $("a[href='" + component_Id_href + "']").get(0).innerText){
  30. header_Text = $("a[href='" + component_Id_href + "']").get(0).innerText;
  31. parent_Component_Id_href = component_Id_href;
  32. }else{
  33. $(component_Id_href + " .panel-body").appendTo( $(parent_Component_Id_href) );
  34. $("div[href='" + component_Id_href + "']").closest( ".panel.panel-default.existing_repeat_entry_panel" ).remove();
  35. }
  36.  
  37. $(container).parent().append(container);
  38. });
  39.  
  40. }
  41.  
  42. $(".finish").on("click", function() {
  43. setTimeout(function(){
  44. window.open('salesforce1://sObject/' + window.formyoula.form_fields["e838-d8cd-04b4"].get("value") + '/view', '_system', 'location=yes');
  45. },1000);
  46. })
  47.  
  48. $( document ).ajaxComplete(function( event, xhr, settings ) {
  49. if ( settings.url.search("/api/salesforce/objects/Form_Question__c/records") > -1 ) {
  50. $('body').append('<div class="custom-loader"><div class="whirl traditional"><div class="spinner-dialog"><span class="spinner-dialog-title">Executing Custome JavaScript</span> <br/><span>Please wait...</span> <br/></div></div></div>');
  51. $(this).ajaxStop(function(){
  52. process_Section_Order();
  53. $('.custom-loader').remove();
  54. });
  55. }
  56. });
Add Comment
Please, Sign In to add comment