kintone x sansan連携事始め~カスタマイズまで
TRANSCRIPT
PowerPoint
kintone x Sansan2016.05.27Sansan
Copyright 2015 Sansan, Inc. All rights reserved.
1 Sansan Sansan API
Copyright 2015 Sansan, Inc. All rights reserved.Sansan20001
Copyright 2015 Sansan, Inc. All rights reserved.
(1/2)3SansanSansan SIerCRM SansanC#, ,
Copyright 2015 Sansan, Inc. All rights reserved.Sansan20003
(2/2)4SansanSansan Sansan
SIer Sansan.NET
Copyright 2015 Sansan, Inc. All rights reserved.Sansan20004
5Sansan 20076260
Copyright 2015 Sansan, Inc. All rights reserved.Sansan20005
Sansan
Copyright 2015 Sansan, Inc. All rights reserved.
Sansan
7
Copyright 2015 Sansan, Inc. All rights reserved.SansanEight7
Sansan8
OCROCR
Database
Copyright 2015 Sansan, Inc. All rights reserved.
8
Copyright 2015 Sansan, Inc. All rights reserved.Sansan API
Copyright 2015 Sansan, Inc. All rights reserved.
11
API
Copyright 2015 Sansan, Inc. All rights reserved.
11
12SansanAPI
GPSIPCRMSFABIMA
Copyright 2015 Sansan, Inc. All rights reserved.13
X
Copyright 2015 Sansan, Inc. All rights reserved.Sansan200013
14XWEB
SFA
Copyright 2015 Sansan, Inc. All rights reserved.Sansan200014
ver1.0API15SetAPISansanSet
SetAPISansanSet
API
SetAPISansanSet
Copyright 2015 Sansan, Inc. All rights reserved.
16IDID[ ]TELFAXURLemailmobile[ ]
Copyright 2015 Sansan, Inc. All rights reserved.
Sansan API 17Sansan APISansanAPI KeyHTTP API Key
Sansan
API KeyHTTP
Copyright 2015 Sansan, Inc. All rights reserved.
Copyright 2015 Sansan, Inc. All rights reserved.
4-1. 4-2. UI4-3. Sansan API
Copyright 2015 Sansan, Inc. All rights reserved.
4-1. 4-2. UIhttps://github.com/ikatsuki/plugin-sdk/pull/44-3. Sansan APIhttps://github.com/ikatsuki/plugin-sdk/pull/5
Copyright 2015 Sansan, Inc. All rights reserved.-1
Copyright 2015 Sansan, Inc. All rights reserved.
Sansan for kintone
cybozu.com developer network zipGithub
https://cybozudev.zendesk.com/hc/ja/articles/207420183-Sansan-for-kintonehttps://github.com/kintone/plugin-sdk
Copyright 2015 Sansan, Inc. All rights reserved.
Cloud Github kintone kintone
Copyright 2015 Sansan, Inc. All rights reserved.
Cloud Github kintone kintone
Copyright 2015 Sansan, Inc. All rights reserved.Cloud9
Copyright 2015 Sansan, Inc. All rights reserved.GitHub $ git clone https://github.com/kintone/plugin-sdk.gitplugin-sdk plugin-sdk/examples/sansan
Copyright 2015 Sansan, Inc. All rights reserved.
Cloud Github kintone kintone
Copyright 2015 Sansan, Inc. All rights reserved.$ sh plugin-sdk/package.sh plugin-sdk/examples/sansan/ workspace IDPluginIDplugin-sdk/plugins/{PluginId}/plugin.zip
Copyright 2015 Sansan, Inc. All rights reserved.
Cloud Github kintone kintone
Copyright 2015 Sansan, Inc. All rights reserved.
kintone
Copyright 2015 Sansan, Inc. All rights reserved.
Copyright 2015 Sansan, Inc. All rights reserved.
Copyright 2015 Sansan, Inc. All rights reserved.
Cloud Github kintone kintone kintone
Copyright 2015 Sansan, Inc. All rights reserved.
kintone
Copyright 2015 Sansan, Inc. All rights reserved.
Copyright 2015 Sansan, Inc. All rights reserved.
Copyright 2015 Sansan, Inc. All rights reserved.
Copyright 2015 Sansan, Inc. All rights reserved.
Copyright 2015 Sansan, Inc. All rights reserved.
Copyright 2015 Sansan, Inc. All rights reserved.
Sansan
Copyright 2015 Sansan, Inc. All rights reserved.
IDSansan
Copyright 2015 Sansan, Inc. All rights reserved.
Cloud Github kintone kintone
Copyright 2015 Sansan, Inc. All rights reserved.
Copyright 2015 Sansan, Inc. All rights reserved.
Copyright 2015 Sansan, Inc. All rights reserved.
Copyright 2015 Sansan, Inc. All rights reserved.
Copyright 2015 Sansan, Inc. All rights reserved.
- API Key - 6f1354d392c34c87b72eb4920effa8a8- - Sansan- - - Sansan - - - - - - - Email - Tel TEL
Copyright 2015 Sansan, Inc. All rights reserved.
Cloud Github kintone kintone
Copyright 2015 Sansan, Inc. All rights reserved.Sansan
Copyright 2015 Sansan, Inc. All rights reserved.Sansan
Copyright 2015 Sansan, Inc. All rights reserved.-2 UI
Copyright 2015 Sansan, Inc. All rights reserved.
UI
Sansan
Copyright 2015 Sansan, Inc. All rights reserved.
Cloud Github kintone kintone
Copyright 2015 Sansan, Inc. All rights reserved.workspace $ cp -r plugin-sdk/examples/sansan sansan-customizesansan-customize
Copyright 2015 Sansan, Inc. All rights reserved. (1/4)desktop.js - createLookupListView
//1'' +'' +'' + '' +//1'' +'' + '' +
Copyright 2015 Sansan, Inc. All rights reserved. (2/4)desktop.js - C_COPYFIELD
var C_COPYFIELD = [ CONFIG['copy_owner'],// owner CONFIG['copy_companyname'],// companyName CONFIG['copy_username'],// lastName + firstName CONFIG['copy_departmentname'],// departmentName CONFIG['copy_title'],// title CONFIG['copy_address'],// prefecture + city + street + building CONFIG['copy_email'],//E-mail email CONFIG['copy_tel'],//Tel tel CONFIG['copy_mobile']// mobile ]; var C_COPYFIELD = { owner: CONFIG['copy_owner'],// owner companyname: CONFIG['copy_companyname'],// companyName username: CONFIG['copy_username'],// lastName + firstName departmentname: CONFIG['copy_departmentname'],// departmentName title: CONFIG['copy_title'],// title address: CONFIG['copy_address'],// prefecture + city + street + building email: CONFIG['copy_email'],//E-mail email tel: CONFIG['copy_tel'],//Tel tel mobile: CONFIG['copy_mobile']// mobile };
Copyright 2015 Sansan, Inc. All rights reserved. (3/4)desktop.js - showLookupDialog dialog buttons: { '': function() { // var records = []; $('.sansan-lookup-select:checked').each(function(i, el){ var params = Sansanlookup.getElementParams($(el).parents(".sansan-lookup-tr")); var record = kintone.app.record.get(); for (var key in params) { if(C_COPYFIELD[key] !== 'null'){ record['record'][C_COPYFIELD[key]]['value'] = params[key]; } } records.push(record['record']); }); // Sansan kintone.api('/k/v1/records', 'POST', {app: kintone.app.getId(), records: records}).then(function(resp) { alert(''); }, function(error) { // var errmsg = ''; // if (error.message !== undefined) { errmsg += '\n' + error.message; } alert(errmsg); }); $(this).dialog('close'); }, Cancel: function() { $(this).dialog('close'); } }
Copyright 2015 Sansan, Inc. All rights reserved. (4/4)desktop.js showLookupDialog$(".sansan-lookup-select").click(function() { Sansanlookup.copyFieldParams(Sansanlookup.getElementParams($(this).parents(".sansan-lookup-tr"))); });
Copyright 2015 Sansan, Inc. All rights reserved.
Cloud Github kintone kintone
Copyright 2015 Sansan, Inc. All rights reserved.$ sh plugin-sdk/package.sh sansan-customize/ plugin-sdk/keys/{}keysplugin-sdk/plugins/{Plugin ID}/plugin.zip
Copyright 2015 Sansan, Inc. All rights reserved.
Cloud Github kintone kintone
Copyright 2015 Sansan, Inc. All rights reserved.https://github.com/ikatsuki/plugin-sdk/tree/master/sansan-customize-1https://github.com/ikatsuki/plugin-sdk/pull/4
Copyright 2015 Sansan, Inc. All rights reserved.-3 Sansan API
Copyright 2015 Sansan, Inc. All rights reserved.
Sansan
Sansan
Copyright 2015 Sansan, Inc. All rights reserved.
UISansan
Copyright 2015 Sansan, Inc. All rights reserved.Set66APISansanHTTP GET https://api.sansan.com/v1/tagsSet
Copyright 2015 Sansan, Inc. All rights reserved.SansanAPI
67idstringIDnamestringtypestring (private) (public) (shared)
ownerUser object
Copyright 2015 Sansan, Inc. All rights reserved.
API 68range"me" | "all"(me)type"private" | "public" | "shared"(private)(/tags?type=public&type=shared&...)
limitint (1~100)(100)offsetint(0)
Copyright 2015 Sansan, Inc. All rights reserved.
69HTTPerrorType400required-invalid_value-401invalid_api_key-( API Key )
invalid_app_id-( Application ID)403has_no_permission-API404-429too_many_request"access_count" : number,"retry_after" : numberaccesscount : retryafter : ()500--503--
Error object (200203) HTTP
Copyright 2015 Sansan, Inc. All rights reserved.
APISansan (1/8)desktop.js Sansanlookup Sansan API getSansanTag: function(opt_offset, opt_records) { //Sansan var offset = opt_offset || 0; var alltags = opt_records || []; var url = 'https://api.sansan.com/v1/tags?range=all'; url += '&offset=' + offset; return kintone.plugin.app.proxy(PLUGIN_ID, url, 'GET', {}, {}).then(function(body) { alltags = alltags.concat(JSON.parse(body[0]).data); if (JSON.parse(body[1]) !== 200) { var error_message = JSON.parse(body[0]).error[0].code; if (JSON.parse(body[1]) === 429) { error_message = '\n5'; } return Promise.reject(new Error(error_message)); } //5000 if (alltags.length >= 5000) { return alltags; } if (JSON.parse(body[0]).data.length === 100) { return Sansanlookup.getSansanTag(offset + 100, alltags); } return alltags; }, function(error) { return Promise.reject(new Error(error.message)); }); },
Copyright 2015 Sansan, Inc. All rights reserved.APISansan
(2/8)getLookupTagList: function() {
Sansanlookup.getSansanTag().then(function(sansan_tags) {
//Sansan(0~5000) if (sansan_tags.length === 0) { var nodata_msg =
'' + ''; Sansanlookup.lookUpMessage($(nodata_msg));
Spin.hideSpinner(); return false; } else if (sansan_tags.length
>= 5000) { //5000 var find_msg = '' + '5000
'; Sansanlookup.lookUpMessage($(find_msg)); Spin.hideSpinner();
return false; } else { //2~4999
Sansanlookup.showTagDialog(Sansanlookup.createLookupTagListView(sansan_tags));
} }).catch(function(error) { Spin.hideSpinner(); swal('Error!',
'Sansan\n' + error.message, 'error'); return false; }); },
Copyright 2015 Sansan, Inc. All rights reserved.APISansan (3/8)createLookupTagListView: function(sansan_tags) { var result; var taglist = ""; var count = 0; //Sansan for (var i = 0; sansan_tags.length > i; i++) { var sansan_record = sansan_tags[i]; taglist += '' + //1 '' + '' + '' + '' + //2 '' + '' + escapeHtml(sansan_record['name']) + '' + // '' + '' + ''; count++; } result = '' + '' + '' + //1 '' + '' + count + '' + '' + '' + //2 '' + '' + '' + '' + '' + '' + taglist + '' + ''; return result; },
Copyright 2015 Sansan, Inc. All rights reserved.APISansan (4/8)showTagDialog: function(date_list) { // var $date_dialog = $(''); $date_dialog.attr('id', 'sansan-date-dialog'); $date_dialog.html(date_list); $date_dialog.dialog({ title: '', autoOpen: false, width: 900, maxHeight: 700, show: 400, hide: 400, modal: true, buttons: { Cancel: function() { $(this).dialog('close'); $(this).remove(); } } }); $('#sansan-date-dialog').dialog('open'); $(".sansan-lookup-select").click(function() { var tagId = $(this).parents(".sansan-lookup-tr").find(".sansan_lookup_tagid").val(); Sansanlookup.doSearch(null, tagId); $('#sansan-date-dialog').dialog('close'); $('#sansan-date-dialog').remove(); }); },
Copyright 2015 Sansan, Inc. All rights reserved.APISansan (5/8)Sansan searchSansanData searchSansanData: function(dates, tagId, opt_offset, opt_records) { //Sansan var record = kintone.app.record.get(); var offset = opt_offset || 0; var value = record['record'][C_KEYFIELD]['value'] || ""; var allrecords = opt_records || []; var url = "https://api.sansan.com/v1/bizCards"; if (dates) { url += "?range=all" + "®isteredFrom" + "=" + encodeURIComponent(dates[0]) + "®isteredTo" + "=" + encodeURIComponent(dates[1]); } else if(tagId) { url += "/search" + "?range=all&tagId=" + tagId; } else { url += "/search" + "?range=all"; if (value !== "") { url += "&" + C_ORIGINALFIELD + "=" + encodeURIComponent(value); } } url += "&offset=" + offset; return kintone.plugin.app.proxy(PLUGIN_ID, url, "GET", {}, {}).then(function(body) { allrecords = allrecords.concat(JSON.parse(body[0]).data); if (JSON.parse(body[1]) !== 200) { var error_message = JSON.parse(body[0]).error[0].code; if (JSON.parse(body[1]) === 429) { error_message = "\n5"; } return Promise.reject(new Error(error_message)); } //5000 if (allrecords.length >= 5000) { return allrecords; } if (JSON.parse(body[0]).data.length === 100) { return Sansanlookup.searchSansanData(dates, tagId, offset + 100, allrecords); } return allrecords; }, function(error) { return Promise.reject(new Error(error.message)); }); },
Copyright 2015 Sansan, Inc. All rights reserved.APISansan (6/8)Sansan getLookupListgetLookupList: function(dates, tagId) {
Sansanlookup.searchSansanData(dates, tagId).then(function(sansan_data) {Sansan doSearchdoSearch: function(dates, tagId) { Spin.showSpinner(); this.init(); this.getLookupList(dates, tagId);},
Copyright 2015 Sansan, Inc. All rights reserved.APISansan (7/8)lookupHtml'' +''kintone.events// [/]kintone.events.on(EVENTS, function(event) {
var $lookup = $(kintone.app.record.getSpaceElement(C_SPACEFIELD)); $lookup.append($(Sansanlookup.lookupHtml));
$("#lookup_search_button").click(function() { Sansanlookup.doSearch(); }); $("#lookup_clear_button").click(function() { Sansanlookup.doClear(); }); $("#lookup_setting_button").click(function() { Sansanlookup.init(); Sansanlookup.showDateDialog(Sansanlookup.createDateListView()); }); $("#lookup_tag_button").click(function() { Sansanlookup.getLookupTagList(); }); return event;});
Copyright 2015 Sansan, Inc. All rights reserved.APISansan (8/8)desktop.css#lookup_search_button, #lookup_clear_button, #lookup_setting_button, #lookup_tag_button { margin-left: 5px; height: 40px; border-color: transparent; border-style: solid; border-width: 1px; background-color: transparent; font-size: 14px}
#lookup_search_button:focus, #lookup_clear_button:focus, #lookup_setting_button:focus, #lookup_tag_button:focus { border-color: #3498db; border-style: solid; border-width: 1px}
Copyright 2015 Sansan, Inc. All rights reserved.https://github.com/ikatsuki/plugin-sdk/tree/master/sansan-customize-2https://github.com/ikatsuki/plugin-sdk/pull/5
Copyright 2015 Sansan, Inc. All rights reserved.
Copyright 2015 Sansan, Inc. All rights reserved.