Skip to content

Instantly share code, notes, and snippets.

View anil826's full-sized avatar
🏠
Working from home

Anil anil826

🏠
Working from home
  • New Delhi , India
View GitHub Profile
@anil826
anil826 / DFGoffline.js
Last active November 14, 2019 08:44
new
<script>
// for browsers := get local db data and write on a file as a backup and download that on the devise
var db = Lawnchair( { name:'QFlocalStorage', adapter: localStorage.getItem("f_db_adapter") }, function( store ) {});
//Event listener
window.addEventListener('online', function(event){
var draft_entry = [];
var collection_keys = [];
var updated_data = [];
//Get all the entries id from local db
@anil826
anil826 / draftEntry.js
Created November 5, 2019 12:27
DFG server offline
// for browsers := get local db data and write on a file as a backup and download that on the devise
var db = Lawnchair( { name:'QFlocalStorage', adapter: localStorage.getItem("f_db_adapter") }, function( store ) {
});
var collection_keys = [];
//Get all the entries id from local db
db.keys(function(keys) {
//Collect ids
collection_keys = _.filter(keys, function(key) {
return (new RegExp('forms-')).test(key);
});
@anil826
anil826 / SygentaDFGUpdate.js
Created November 4, 2019 08:25
Update Save record on DFD
$('.finish').on('click', function(e) {
e.stopImmediatePropagation();
//Off the click event
$('.finish').off('click');
var first_name = formyoula.form_fields['ccee-a073-3d63'].get('value');
var last_name = formyoula.form_fields["2e65-9fb3-0133"].get('value')
var user_data = [
{
"typeId":"319013",
"externalId": "000000002",
@anil826
anil826 / gist:a0e0f80822c3e710fea51aa8061979ef
Last active October 30, 2019 05:43
DFG Intergration Contact
//Static records
var record_ids = ['000000002','000000001'];
//Contact Data
var contact_data = null;
// Generic function to make an AJAX call
var DFG_Get_Entity = function(user_token ,record_ids) {
// Return the $.ajax promise
return $.ajax({
url: 'https://test.dfg152.ru:8443/dfg-rest/entity/batch/get',
cors: true,
@anil826
anil826 / calculation_specific_row_sf_table.js
Created October 11, 2019 16:18
Data Table row calculation
//This event trigger on Salesforce Table data render
//Please replace the component-id/merge-id
formyoula.form_fields["598a-89a0-b2ba"].on("table:results:render:rowCallback", function(row) {
//Get all the table data.
var table_data = $("#salesforce_table_598a-89a0-b2ba").DataTable().data().toArray();
//Check for table data
if(table_data.length){
//Init the temp variable for calculation
var total_quantity = 0;
//Loop on table data
@anil826
anil826 / backup-dinesh-repeat_issue.js
Created September 25, 2019 11:54
backup-dinesh-repeat_issue
/*formyoula.form_fields["cf69-4c7b-6390"].on("input:set:success", function(e){
formyoula.form_fields["cf69-4c7b-6390"].trigger("change")
})*/
//formyoula.form_fields["cf69-4c7b-6390"].on("all", function(e){
//console.log(e);
//console.log($("#component-fd56-b750-3c0b input.input_content").val());
/*$("#component-fd56-b750-3c0b input").val().each(function(key, val){
console.log(key);
console.log(val);
@anil826
anil826 / sf_table_regex.js
Created September 12, 2019 07:34
SF Table validaion for Phone number based on regex
//SF table component - id
var component_id = "12da-62aa-a8dc";
// on table render event
formyoula.form_fields[component_id ].on("table:results:render:rowCallback",function(){
update_input_field();
})
//Check on table render success event
formyoula.form_fields[component_id ].on("table:results:render:success",function(){
console.log("rendered*****");
update_input_field();
@anil826
anil826 / signature.js
Created September 6, 2019 13:20
Graham Check signature
//Hidden field
formyoula.form_fields['4556-bd6d-675d'].on("change",function(){
//Get img url - from hidden field
var img_url = formyoula.form_fields['4556-bd6d-675d'].get('value');
//check if there is URL
if(img_url.match("http")) {
//Hide the signature element
$("#component-30c1-3ddb-39d4").hide();
//Set Img URL to Formyoula HTML element - This is an HTML element
$("#component-8d9a-5809-dd75").html(img_url);
@anil826
anil826 / Password-validation.js
Created August 31, 2019 15:56
Validate the Password via Custom JS
$('.finish').on('click', function(e) {
e.stopImmediatePropagation();
//Check password and throw alert if not == "Welcome@123"
if ( formyoula.form_fields['554e-c74b-f697'].get('value') == "Welcome@123") {
$('.finish').off('click');
$(this).click();
} else {
alert('Warning : Invalid Password !!');
return;
}
@anil826
anil826 / nehav2zip.js
Created August 13, 2019 16:14
syngenta
$(document).ready(function() {
$("body.div.alert.alert-danger.alert-dismissible").hide();
var is_sales_orders = false;
var is_marketing_early_pay = false;
var is_marketing_totals = false;
var is_discretionary = true;
var is_pricelineAmountSum = false;