I have built a custom button in salesforce on the opportunity object to link back to docusign and run a very specific set of actions. At first when i put the button in salesforce i would receive an error code. Now, i cannot get the button to fire at all. I ran firebug on the button and i see that there is a javascript error. I will pubslish all that i have here. You can also reference my previous question here: Custom Salesforce button for Docusign giving error - unexpected token~
{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
//********* Option Declarations (Do not modify )*********//var RC = '';var RSL='';var RSRO='';var RROS='';var CCRM='';var CCTM='';varCCNM='';var CRCL=''; var CRL='';var OCO='';var DST='';var LA='';var CEM='';varCES='';var STB='';varSSB='';var SES='';var SEM='';var SRS='';var SCS ='';varRES='';//*************************************************//
// Modify individual options here://RSRO = '1';RROS = '1';CRL = 'Email~anthony.m#playmakercrm.com;FirstName~Anthony;LastName~Miranda;Role~Signer 1;RoutingOrder~1;SignNow~1'; OCO = 'Tag';LA = '1';STB = '1';SSB = '1';SES = '1';SEM = '1';SRS = '1';
//********* Page Callout (Do not modify) *********//window.location.href ="/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Opportunity.Id}&RC="+RC+"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"&CCRM="+CCRM+"&CCTM="+CCTM+"&CRCL="+CRCL+"&CRL="+CRL+"&OCO="+OCO+"&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES="+CES+"&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES+"&SEM="+SEM+"&SRS="+SRS+"&SCS="+SCS+"&RES="+RES;
//*******************************************//
Here is the error code i see from within firebug:
<script>
window.invokeOnClickJS_00bj0000001KavA = function(element) {
function getRecordIds(keyPrefix) { return Scontrol.prototype.getSelectedRecordIdsFromForm(element.form, keyPrefix); }
element.invokeAction = function() {
var scriptLibrary = [];
scriptLibrary.push("/apex/dsfs__DocuSign_JavaScript");
Util.loadScripts(scriptLibrary, 0, function() {
try { Util.stripCustomFunctionFromObjectPrototype(Array);eval('\r\n\r\n/\/\*\*\*\*\*\*\*\*\* Option Declarations (Do not modify )\*\*\*\*\*\*\*\*\*\//var RC = \'\';var RSL=\'\';var RSRO=\'\';var RROS=\'\';var CCRM=\'\';var CCTM=\'\';varCCNM=\'\';var CRCL=\'\'; var CRL=\'\';var OCO=\'\';var DST=\'\';var LA=\'\';var CEM=\'\';varCES=\'\';var STB=\'\';varSSB=\'\';var SES=\'\';var SEM=\'\';var SRS=\'\';var SCS =\'\';varRES=\'\';/\/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\//\r\n\r\n// Modify individual options here://RSRO = \'1\';RROS = \'1\';CRL = \'Email~anthony.m#playmakercrm.com;FirstName~Anthony;LastName~Miranda;Role~Signer 1;RoutingOrder~1;SignNow~1\'; OCO = \'Tag\';LA = \'1\';STB = \'1\';SSB = \'1\';SES = \'1\';SEM = \'1\';SRS = \'1\';\r\n\r\n/\/\*\*\*\*\*\*\*\*\* Page Callout (Do not modify) \*\*\*\*\*\*\*\*\*\//window.location.href =\"/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID=006j000000KsS79&RC=\"+RC+\"&RSL=\"+RSL+\"&RSRO=\"+RSRO+\"&RROS=\"+RROS+\"&CCRM=\"+CCRM+\"&CCTM=\"+CCTM+\"&CRCL=\"+CRCL+\"&CRL=\"+CRL+\"&OCO=\"+OCO+\"&DST=\"+DST+\"&CCNM=\"+CCNM+\"&LA=\"+LA+\"&CEM=\"+CEM+\"&CES=\"+CES+\"&SRS=\"+SRS+\"&STB=\"+STB+\"&SSB=\"+SSB+\"&SES=\"+SES+\"&SEM=\"+SEM+\"&SRS=\"+SRS+\"&SCS=\"+SCS+\"&RES=\"+RES;\r\n/\/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\//') } catch (e) { alert('A problem with the OnClick JavaScript for this button or link was encountered:\n\n' + (e.message ? e.message : e)) }
finally { Util.restoreCustomFunctionsToObjectPrototype(Array);}
});
};
element.invokeAction();
}
</script>
I don't think you're ending the comments correctly. Normally, comments are on a line by themselves or use a specific end of comment sequence.
You seem to be able to have multiple lines in your button code. Are you sure that you can? I'd make it all smaller and tighter.
You also have some errors such as varCCNM instead of the correct var CCNM (You need a space after the keyword var
Note that you can have multiple Javascript var declarations in one statement. Eg:
var a=1, b=2;
// Instead of
var a=1; var b=2;
So I would try
{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
var RC = '', RSL='', RSRO='', RROS='', CCRM='', CCTM='', CCNM='', CRCL='', CRL='', OCO='', DST='', LA='', CEM='', CES='', STB='', SSB='', SES='', SEM='', SRS='', SCS='', RES='';
RSRO = '1'; RROS = '1'; CRL = 'Email~anthony.m#playmakercrm.com;FirstName~Anthony;LastName~Miranda;Role~Signer 1;RoutingOrder~1;SignNow~1'; OCO='Tag';LA='1';STB ='1';SSB = '1';SES = '1';SEM = '1';SRS = '1';
window.location.href ="/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Opportunity.Id}&RC="+RC+"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"&CCRM="+CCRM+"&CCTM="+CCTM+"&CRCL="+CRCL+"&CRL="+CRL+"&OCO="+OCO+"&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES="+CES+"&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES+"&SEM="+SEM+"&SRS="+SRS+"&SCS="+SCS+"&RES="+RES;
If button definitions can't contain new line characters, then just concatenate the above together onto one line.
Related
Link to the filter:
code: http://jsfiddle.net/ar3PY/92/
Question:
I can filter and I will get result "empty"
But how to disable checkboxes that will anyway appear empty when filtering.
!!Notice that each category shall no filter with itself, only with other categories.
For example:
If I check "VOLVO" and "SILVER" I get "empty".
What I looking for:
If I check "VOLVO", then "SILVER" will be disabled.
Image that show how it should work:
Basically you just needed to access your class attributes to make it work. I forked your fiddle, here's the modified version:
$("#filters :checkbox").click(function() {
var subj = this;
resetBoxes();
$(".filterme").show();
if(this.checked){
var all = $(".filterme");
var tgts = all.filter(getFilter("brand")).filter(getFilter("class")).filter(getFilter("color"));
var brandtgt = tgts[0].className.split(' ')[1];
$("#filters :checkbox").each(function(idx){
var inval = $(this).attr("value");
var brandclasses = tgts[0].className.split(' ');
var found = $.inArray(inval, brandclasses);
if(found<0){
disable($(this));
}
});
all.not(tgts).hide();
tgts.show();
if (tgts.length == 0) {
$('.empty').show();
} else {
$('.empty').hide();
}
}
});
I've included helper functions (resetBoxes, enable, disable) found in the working fiddle below.
http://jsfiddle.net/ppzwmvs9/6/
How to show content of checked filter that only has exacly same attribute for each category?
see also image for explanation:
.
JSFIDDLE HERE:
http://jsfiddle.net/ar3PY/104
.
var getFilter = function (category) {
var filter = $("#filters ." + category + ":checked").map(function () {
return '[data-filter*="' + this.value + '"]';
}).get().join(",");
filter = (filter.length > 0) ? filter : "*";
return filter;
}
I have an iframe inside an angularjs application. I am switching to the iframe using switchTo().
I need to get the table first which has the value I'm looking for. I need to get the Yield total from within the table. I need to find the yieldtotal inside the table using cssContainingText() beacuse the attributes for everything inside the table are the same. The yield total may or may not be present. I used yieldTotal.isPresent() but it throws an error saying "window.angular is undefined. It may be because it is not an angular application"
I cannot use browser.driver.findElement because I cannot find elementbytext that way.
function verifyGrossInvoiceTotal(){
browser.ignoreSynchronization = true;
browser.driver.switchTo().frame('viewDocumentInFrame');
var ProductTable = $('table.invoice-details'));
var sum = 0;
var YieldTotal = ProductTable .element(by.cssContainingText('td', 'Yield Total')).element(by.xpath('..'));
**YieldTotal.isPresent()**.then(function (isPresent){
if(isPresent){
var totalAmount = YieldTotal .$$('td').get(3);
totalAmount.getText().then(function (text) {
text = parseFloat(text.replace(/[^0-9.]/g, '')).toFixed(2);
sum = parseFloat(sum) + parseFloat(text);
});
}
});
});
I think this is because td is not directly under ProductTable. Can you try something like below? Basically 'table.invoice-details td' CSS means, find any td anywhere under table.invoice-details
function verifyGrossInvoiceTotal(){
browser.ignoreSynchronization = true;
browser.driver.switchTo().frame('viewDocumentInFrame');
var sum = 0;
var YieldTotal = element(by.cssContainingText('table.invoice-details td', 'Yield Total'));
YieldTotal.isPresent().then(function (isPresent){
if(isPresent){
var totalAmount = YieldTotal .$$('td').get(3);
totalAmount.getText().then(function (text) {
text = parseFloat(text.replace(/[^0-9.]/g, '')).toFixed(2);
sum = parseFloat(sum) + parseFloat(text);
});
}
});
});
i have a project am working about a shopping list and am making in such a way that the user types the item he wants to add and whenever he adds it displays that he has dded a particular product and not to forget he has the ability to remove any product from the list. But when never i reload the page it displays empty even though i already added some item previously..this is the code
var app = angular.module("shoppingList",[]);
app.controller("myCtrl",function($scope){
$scope.goods = []
var taskData = localStorage()
$scope.addItem = function(){
$scope.errorText = "";
if(!$scope.addNew){return;}
if($scope.goods.indexOf($scope.addNew) == -1){
$scope.goods.push($scope.addNew);
}else{
$scope.errorText = "The Item is already in your shopping list"
}
};
$scope.removeItem = function(x){
$scope.errorText = ""
$scope.goods.splice(x,1);
}
})
It is a good idea to use https://github.com/gsklee/ngStorage in your app, because it will let you use localstorage the angular way. so to rewrite your code with ngStorage:
var app = angular.module("shoppingList",['ngStorage']);
app.controller("myCtrl",function($scope,$localStorage){
$scope.goods = $localStorage.goods || [];
var taskData = localStorage()
$scope.addItem = function(){
$scope.errorText = "";
if(!$scope.addNew){return;}
if($scope.goods.indexOf($scope.addNew) == -1){
$scope.goods.push($scope.addNew);
$localStorage.goods.push($scope.addNew);
}else{
$scope.errorText = "The Item is already in your shopping list"
}
};
$scope.removeItem = function(x){
$scope.errorText = ""
$scope.goods.splice(x,1);
$localStorage.goods.splice(x,1);
}
})
hope this works for you
I am newbie to AngularJs. Here is my code. In this i am trying to build the url by getting system date. But the values are not substituting at the time of jsonp request. I don't know Why.
Here when i try to add parameters manually. i am getting the values. But when i try to use the variables i am not getting the output.
$scope.getCurrentMonthData = function(){
$scope.date = new Date();
$scope.startday = 1;
$scope.currentday = $scope.date.getDate()+1;
$scope.month = $scope.date.getMonth()+1;
$scope.year = $scope.date.getFullYear();
$scope.start= $scope.year+'/'+$scope.month+'/'+$scope.startday;
$scope.end = $scope.year+'/'+$scope.month+'/'+$scope.currentday;
$scope.url1 = $rootScope.ApiWeatherHost+'/climo/v1/actuals/'+$scope.location_key+'.json?start='+$scope.start+'&end='+$scope.end+'&apikey='+$rootScope.ApiKey;
$scope.url2 = $rootScope.ApiWeatherHost+'/climo/v1/records/'+$scope.location_key+'.json?start='+$scope.start+'&end='+$scope.end+'&apikey='+$rootScope.ApiKey;
$scope.url3 = $rootScope.ApiWeatherHost+'/climo/v1/normals/'+$scope.location_key+'.json?start='+$scope.start+'&end='+$scope.end+'&apikey='+$rootScope.ApiKey;
$http.jsonp($scope.url1).then(function(msg){
console.log(msg.data);
});
$http.jsonp($scope.url2).then(function(msg){
console.log(msg.data);
});
$http.jsonp($scope.url3).then(function(msg){
console.log(msg.data);
});
};
I don't see where you are defining location_key so I don't know for certain if that is your problem, but when I run the following code, I see all three URL's created.
Have you checked to see if there is an error when you attempt to make those requests?
(function($scope, $rootScope){
$scope.date = new Date();
$scope.startday = 1;
$scope.currentday = $scope.date.getDate()+1;
$scope.month = $scope.date.getMonth()+1;
$scope.year = $scope.date.getFullYear();
$scope.start= $scope.year+'/'+$scope.month+'/'+$scope.startday;
$scope.end = $scope.year+'/'+$scope.month+'/'+$scope.currentday;
$scope.url1 = $rootScope.ApiWeatherHost+'/climo/v1/actuals/'+$scope.location_key+'.json?start='+$scope.start+'&end='+$scope.end+'&apikey='+$rootScope.ApiKey;
$scope.url2 = $rootScope.ApiWeatherHost+'/climo/v1/records/'+$scope.location_key+'.json?start='+$scope.start+'&end='+$scope.end+'&apikey='+$rootScope.ApiKey;
$scope.url3 = $rootScope.ApiWeatherHost+'/climo/v1/normals/'+$scope.location_key+'.json?start='+$scope.start+'&end='+$scope.end+'&apikey='+$rootScope.ApiKey;
var output = $('#output');
$('<div>').text($scope.url1).appendTo(output);
$('<div>').text($scope.url2).appendTo(output);
$('<div>').text($scope.url3).appendTo(output);
}({}, {ApiWeatherHost:'www.fake-api.com', ApiKey:'12345'}));
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id='output'></div>
Even though I have my userscript restricted to one domain, any site I visit that uses Jquery experiences all kinds of nasty issues when my script is active. Checking the error console in chrome reveals an identical error on all sites:
"Uncaught TypeError: Property '$' of object [object Window]"
What's causing this? My objective is to get my userscript running in noconflict mode on a site that uses both jquery and prototype. I didn't make the code above var = myFunction, so I don't know what about it is causing the problem I'm running into. Any suggestions?
// ==UserScript==
// #name Restore Dashboard Tags
// #namespace http://userstyles.org
// #description This script restores a user's tracked tag list to the sidebar on tumblr
// #author
// #homepage
// #history 1.0 first version
// #include http://www.tumblr.com/*
// #match http://www.tumblr.com/*
// ==/UserScript==
var jQuery, $ = null;
function addJQuery(callback) {
var p = null;
if(window.opera || window.navigator.vendor.match(/Google/)) {
var div = document.createElement("div");
div.setAttribute("onclick", "return window;");
p = div.onclick();
}
else {
p = Window;
}
jQuery = $ = p.jQuery.noConflict();
callback();
}
var myFunction = function() {
jQuery('div#right_column ul:first-child').after('<ul class="controls_section" id="tracked_tags"></ul>');
jQuery('div.tracked_tags a').each(function (i) {
var tagID = jQuery(this).attr("id");
var tagIDNumber = tagID.replace('tag_','');
var tagName = jQuery(this).attr("href");
var tagNameClean = tagName.replace('/tagged/','');
var tagContent ='';
tagContent += '<li><a href="'+tagName+'" id="'+tagID+'" class="tag">';
tagContent += '<div class="hide_overflow">'+tagNameClean+'</div>';
tagContent += '<span id="tag_unread_'+tagIDNumber+'" class="count" style=""></span></a></li>';
jQuery(tagContent).appendTo('div#right_column ul#tracked_tags');
});
};
var NewPosts = function(){
jQuery('div.tracked_tags > div').each(function (i) {
var thisIndex = jQuery(this).index();
if (jQuery(this).find('small').length){
var postCount = jQuery(this).find('small').text();
jQuery('div#right_column ul#tracked_tags li:eq('+thisIndex+')').find('.count').html(postCount.replace("new posts", "") );
}
});
setTimeout(NewPosts,30000);
}
addJQuery(myFunction);
addJQuery(NewPosts);
The problem has been solved! Someone on another site IDed the culprit as jQuery = $ = p.jQuery.noConflict();; since I wasn't loading my own copy of Jquery I didn't need noConflict, and its usage was hiding Jquery from the rest of the page.