diff --git a/plugin/kintone-addins/src/actions/login-user-getter.ts b/plugin/kintone-addins/src/actions/login-user-getter.ts new file mode 100644 index 0000000..3d57591 --- /dev/null +++ b/plugin/kintone-addins/src/actions/login-user-getter.ts @@ -0,0 +1,76 @@ +import { actionAddins } from "."; +import { IField,IAction,IActionResult, IActionNode, IActionProperty,IContext,IVarName} from "../types/ActionTypes"; +//右UI画面propertyのname:型: +interface ILoginUserGetterProps{ + //変数名にセット:値がオブジェクトの形式 + verName:IVarName; +} +//IActionインタフェースを実装する新しいクラスActionを作成: +export class LoginUserGetterAction implements IAction{ + name: string; + //importから導入顕示定義 + actionProps: IActionProperty[]; + //上方のinterface Propsから、props受ける属性を定義: + props:ILoginUserGetterProps; + //関数定義に必要な類名を構築: + constructor(){ + //pgAdminDBに登録したアクション名(name/subtitle)一致する必要がある: + this.name="ログインユーザー取得"; + this.actionProps=[]; + this.register(); + //プロパティ属性初期化: + this.props={ + verName:{name:''} + } + //リセット上記登録表: + this.register(); + } +/** + * アクションの処理を実装する + * @param actionNode アクションノード + * @param event Kintoneのイベント + * @param context コンテキスト(レコード、変数情報を持っている) + * @returns + */ +  //非同期処理ある関数下のある属性: + async process(actionNode:IActionNode,event:any,context:IContext):Promise { + let result={ + canNext:true, + result:false + }; + try{ + //属性設定を取得する: + this.actionProps=actionNode.actionProps; + //プロパティ設定のデータ型は必要な情報含めますか?全部不存在時return: + if (!('verName' in actionNode.ActionValue)) { + return result + } + //既定のプロパティのインタフェースへ変換: + this.props = actionNode.ActionValue as ILoginUserGetterProps; +////////////////////////////////////////////////////////////////////////////////////// + if(this.props.verName&&this.props.verName.name!==''){ + context.variables[this.props.verName.name]=kintone.getLoginUser(); + // window.alert("変数名"+this.props.verName.name+"の値は"+context.variables[this.props.verName.name]+"です"); + // event.record["変数運用先のユーザ選択フィールド"].value= [{code:context.variables[this.props.verName.name].code}]; + } +////////////////////////////////////////////////////////////////////////////////////// + result= { + canNext:true, + result:true + } + return result; +////////////////////////////////////////////////////////////////////////////////////// + }catch(error:any){; + event.error=error.message; + return { + canNext:false, + result:false + } + } + } +////////////////////////////////////////////////////////////////////////////////////// + register(): void { + actionAddins[this.name]=this; + } +} +new LoginUserGetterAction(); \ No newline at end of file diff --git a/plugin/kintone-addins/src/types/action-process.ts b/plugin/kintone-addins/src/types/action-process.ts index 26e7afb..a97cf8c 100644 --- a/plugin/kintone-addins/src/types/action-process.ts +++ b/plugin/kintone-addins/src/types/action-process.ts @@ -15,6 +15,7 @@ import '../actions/value-getter'; import '../actions/string-join'; import '../actions/validation-fullwidth'; import '../actions/validation-halfwidth'; +import '../actions/login-user-getter'; import { ActionFlow,IActionFlow, IActionResult,IContext } from "./ActionTypes";