- _date.start_of_today() : get timestamp start of today
- _date.end_of_today() : get timestamp end of today
- _date.start_of_week() : get timestamp start of week (monday - sunday)
- _date.end_of_week() : get timestamp end of week (monday - sunday)
- _date.start_of_month() : get timestamp start of month (range date 1 - 28/29/30/31)
- _date.end_of_month() : get timestamp end of month (range date 1 - 28/29/30/31)
- _date.start_of_year() : get timestamp star of year
- _date.end_of_year() : get timestamp end of year
- _date.today() : to show today’s data (only)
- _user.user_company_id : get data user_company_id form SESSION Login
- _user.company_id : get data company_id form SESSION Login
- _user.email : get data email form SESSION Login
- _user.position_id : get data position_id form SESSION Login
- _user.token : internal variable to get token form SESSION Login
- _field : get data field on create view or detail view
- _record : get data from data manager on create view or detail view
- _stopAutomation() : to stop automation on next block
Example
if (error) {
_stopAutomation()
}
- _readGoogleSheet()
- _sqlFetch()
- _sqlExec()
- _sqlDatabases()
- _readGoogleSheet() : _readGoogleSheet, digunakan untuk export ke spreadsheet dari row
Example
var sheetID =
'1VrM7lAw_DWtuFZtmXtBpyc9Vy11a1DCDHi4Z00s1fnA';
var sheetName = 'Data2';
var mapHeader = {ID:'id', NAME:'nama',
NUMBER:'nomor'};
var hasil = _readGoogleSheet(sheetID, sheetName,
mapHeader);
_log(hasil); // hasilnya akan berupa object atau array of object
- _exportFormDataToGoogleSheet() : _exportFormDataToGoogleSheet, digunakan untuk mengambil data record di database lalu export ke spreadsheet.
Example
var sheetID =
'1VrM7lAw_DWtuFZtmXtBpyc9Vy11a1DCDHi4Z00s1fnA';
var formDataID = 'aihyta_a';
var option = {header: [], sheet_name: "Data1"};
var filter = {};
var sort = {};
var hasil = _exportFormDataToGoogleSheet(sheetID,
formDataID, filter, sort, option);
_log(hasil); // hasilnya akan berupa link ke google spreadsheet
- _exportToGoogleSheet() : _exportToGoogleSheet, digunakan untuk export ke spreadsheet dari row
Example
var sheetID =
'1VrM7lAw_DWtuFZtmXtBpyc9Vy11a1DCDHi4Z00s1fnA';
var sheetName = 'Data2';
var rows = [{id:1, name:'Kuuv'}];
var header = {id:'ID', name:'Name'};
var headerOrder = ['id','name'];
var hasil = _exportToGoogleSheet(sheetID, sheetName
rows, header, headerOrder);
_log(hasil); // hasilnya akan berupa link ke google spreadsheet
- Contoh Pembuatan API Google Spreadsheet dan Shared Access
https://bitbucket.org/jojocoders/nocodeservice/src/a43f22495c1b5717ceeec88fc221d03b1ac1c7d1README.md
- _exportExcel() : exportExcel akan menghentikan seluruh response dan mengembalikan file excel (support 1 sheet)
Example
var fileName='report.xls';
var sheetName='Sheet Test';
var data=[{id:1,name:'Arief'},{id:2,name:"Budi"}];
var headerMap={id:"ID",name:"Name"};
var headerOrder = ['id','name'];
_exportExcel(fileName,sheetName,data,headerMap,headerOrder);
- exportExcelMultipleSheet() : _exportExcelMultipleSheet mengenerate file excel yang memiliki multiple sheet
Example
_exportExcelMultipleSheet(fileName, sheets)
sample :
var fileName='report.xls';
var sheetName='Sheet Test';
var data=[{id:1,name:'Arief'},{id:2,name:"Budi"}];
var headerMap={id:"ID",name:"Name"};
var headerOrder = ['id','name'];
var sheets = [
{
sheetName: sheetName,
data: data,
headerMap: headerMap,
headerOrder: headerOrder
},
{
sheetName: 'sheet2',
data: [
{
a: 'b',
a b ,
c: 'd'
}
],
headerMap: {a:"A", b:"B"},
headerOrder: ['b','a']
}
]
_exportExcelMultipleSheet(fileName, sheets);
- _auditTrail() : to get data log (history)
Example
_auditTrail(token, formDataID, page, limit);
- _pagination.page
- _sendEmail() : internal function to send email _sendEmail(to, cc, bcc, subject, message)
Example
var send_email = {
"bcc": [],
"cc": [],
"message": "test body email",
"subject": "Test Subject email",
"to": ["jojoqa@mailinator.com","reza@jojonomic.com
"ika@jojonomic.com"]
};
_sendEmail(send_email.to, send_email.cc,
send_email.bcc, send_email.subject,
send_email.message);
#penulisan tanpa enter
- _auditTrail() : internal function to get log from data manager
Example
var token = 'token';
var formDataID = 'id-form-data';
var page = 1; // ini minimal 1
var limit = 10; // ini maksimal 10_000
var filter = {
var hasil = _auditTrail(token, formDataID, page, limit, filter);
- _env.company_id : internal function untuk mengambil data environment company_id Data type Integer
- _base64EncodeImage() : internal function to endcode image url with base64
Example
var img = "https://jojo-receipt-new.s3.ap-southeast
1.amazonaws.com/20011/611334a79b18f-Gabby-Thomas.jp
var imgEncoded = _base64EncodeImage(img);
- _bcrypt() : to save value of password with hash and salt
var password = 123!45
var hash = _bcrypt(password)
- _bcryptValidate() : Digunakan untuk untuk membandingkan hashedPassword dengan input user. Mengembalikan nilai true jika hashedPassword == input
isValid = _bcryptValidate(hashedPassword, password
- _sha1 : Berfungsi mendapatkan hash sha1 dari suatu text
Example
_sha1(input)
sample :
output = _sha1"abcde")
// output = "03de6c570bfe24bfc328ccd7ca46b76eadaf433
- sha256 : Berfungsi mendapatkan hash dari suatu string menggunakan algoritma sha256
Example
_sha256(input)
sample :
output = _sha256"hello world\n")
// output =
"a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0f99a192a447"
- _log() : Berfungsi mengirimkan log ke log history. Dapat dilihat di history automation
Example
var data={
a: "b",
c: "d"
}
_log(data)
- _base64encode() : Berfungsi untuk mengubah data ke base64
Example
_base64encode(data)
sample :
var data = 'base';
var en64 _base64encode(data);
_log(en64); // hasilnya YmFzZQ
- _base64decode() : Berfungsi untuk mengubah base64 ke data
Example
_base64decode(data)
sample :
var en = 'YmFzZQ';
var de64 _base64decode(en);
_log(de64); // hasilnya : base
- _hitFunction() : Fungsi ini berfungsi untuk memanggil visual programming tipe function. Pemanggilan menggunakan _hitFunction(functionName, inputData) dimana inputData dapat diisi bentuk javascript array, object, text, number, dan sebagainya. Input data akan masuk ke container_variable visual programming tipe function. Output akan diambil dari container_response visual programming tersebut
Example
hitFunction(FunctionName, InputData)
output = hitFunction('function_name', {'input1':4}
- _hitExternalAPI : to call external API
Example
_hitExternalAPI(url,method,body,header)
sample :
x=_hitExternalAPI('https://apicore.jojonomic.com/nocode/test/post','POST',{a:'b'}
{'content-type':'application/json'};
_log(x);
pada contoh di atas x akan berisi :
x={
status_code: 200,
header: {
'Content-Type': '',
'Content-Length': ''
},
body: {
YourRequest: {
a: 'b'
}
}
}
- _hitExternalAPIByForm()
Example
_hitExternalAPIByForm(url,method,body,header)
sample :
x=_hitExternalAPIByForm('https://apicore.jojonomic.com/nocode/test/post','POST',{a:'b'}
{'content-type':'application/json'};
_log(x);
pada contoh di atas x akan berisi :
x={
status_code: 200,
header: {
'Content-Type': 'application/x-www-formurlencoded',
},
body: {
YourRequest:{
a: 'b'
}
}
}
- _generateJWT() : generate token berdasarkan suatu object
Example
_generateJWT(data_user, secret_key, expired_in_milisecond
sample :
var token = _generateJWT({"name": "john doe", "emai
"john@doe"}, "my-secret-key", 6000);
- _generateJWTJojonomic() : generate token jojo berdasarkan company id dari suatu user
Example
_generateJWTJojonomic(user_company_id, token)
sample :
var token = _generateJWTJojonomic("CompanyID", "You
valid token");
- _validateJWT : Memeriksa sebuah token apakah token tersebut valid / tidak dan expired / tidak
Example
_validateJWT(token, secret_key)
sample :
var isValid = _validateJWT("qwerty", "my-secret-key")
- _decodeJWT : generate suatu object berdasarkan token tertentu
Example
_decodeJWT(token, secret_key)
sample :
var data_user = _decodeJWT("qwerty", "my-secret-key")
- _base64EncodeImage() : mengubah image url menjadi format base64
Example
_base64EncodeImage(image_url)
sample:
var encoded_image =
_base64EncodeImage("http://domain.com/imageurl.png",);
- _profile() : Berfungsi mendapatkan detail data user profile dengan mengirimkan token
Example
_profile(token)
sample :
var token = "your token";
var profile = _profile(token);
console.log(profile)
// example output
{
"id": 12xx6,
"user_id": 12xx1,
"email": "admin@jojomining.com",
"personal email": "ginfa@tesing.com",
personal_email : ginfa@tesing.com ,
"first_name": "Bambangs",
"last_name": "Yudoyono",
"other_name": "",
"gender": "Male",
"nationality_type": "Warga Negara Indonesia
(WNI)",
"salutation": "Mr. (Married)",
"religion": "Islam",
"marital_status": "Married",
"date_of_birth": "1992-01-19",
"place_of_birth": "1JAKARTAAAA2",
"age": 29,
"photo_url": "https://s3-ap-southeast1.amazonaws.com/jojo-receipt-new/3/image.jpg",
"phone": "",
"mobile_phone": "08121314xxxxxx",
"phone_number": "08121314xxxxxx",
"phone_country_id": 0,
"fax_number": "",
"identity_number": "",
"id_type": 0,
"identity_type": "",
"id_number": "",
"id_expired_date": "0000-00-00",
"about": "",
"iban": "",
"country": "Albania",
"country_id": 2,
"province": "",
"province_id": 0,
"city": "",
"city_id": 0,
"address_type": 0,
"address":"jalan- jalan",
"address_2": "",
"address_3": "",
"postal_code": "",
"post_code": "",
"latitude": 0,
"longitude": 0,
"passport_number": "",
"passport_expirity_date": "0000-00-00",
"passport_issuing": "",
"passport_issuing_alpha2": "",
"passport_issuing_alpha3": "",
"passport_issuing_id": 0,
"passport_issuing_date": "2019-01-02",
"passport_nationality": "",
"passport_nationality_alpha2": "",
"passport_nationality_alpha3": "",
"passport_nationality_id": 0,
"dialing_code": "",
"created_date": "2016-09-19 08:43:42",
"updated_date": "2020-07-18 23:40:29",
"refresh_token": "xxx",
"employee_id": "AAA100",
"user_company_id": 1881,
"role_names": [
"admin",
"sysadmin",
"approver",
"finance",
"management",
"hr",
"staff",
"admin_payroll"
],
"expired_date": "2025-03-18 02:04:44"
}
- _profileByUserCompanyID : Berfungsi mendapatkan detail data user profile berdasarkan data user company id serta mengirimkan token
Example
_profileByUserCompanyID(token, user_company_id)
sample :
var token = "your token";
var profile = _profileByUserCompanyID(token,
user_company_id);
- _getUserByOrganigramID : Berfungsi mendapatkan detail data user profile berdasarkan organigram id serta mengirimkan token
Example
var token = "your token";
var profile = _getUserByOrganigramID(organigram_id
token);