Environment - Vendor portal, Mailbox, etc. CorrelationProperty_Submit_Invoice Submit_the_invoice Gateway_validation_successful_question_mark Activity_1colhao Activity_1u89kok Event_1r3yh2kx Event_invoice_validation_failed Gateway_0wk5se9 Activity_show_errors Gateway_0dqj39f Activity_10p5t0r Activity_0twki30 Activity_07oyzdx Event_15y55nw Gateway_1lbghql Event_0x83ruk Event_0m3ri6v Gateway_1l4tz4i Event_1b58a3z Activity_0faln91 Gateway_05ov5p5 Activity_0p88elm Gateway_1717c0p Activity_104xpp8 Activity_175j3o7 Event_176ch98 Delete_File Event_1usbnt0 Event_0lhkxwc Activity_0fq1nb4 Event_1vi3um1 Event_0rwxlca SubProcess_Data_validation_rules Activity_0rae8g6 Activity_1ucvkk4 Activity_1kgaqpf Activity_0gkpa9s Activity_0gkejaj Waku_Message_Pending_Payment Activity_1t8wi0r Gateway_06i3we9 Activity_06b32ar Event_09q0ym0 Activity_0cdgqi0 Gateway_1ytq6m7 Event_1simh9k not(svc_is_invoice_submit_pass) not(isMatch) not(isInvoiceApproved) not(isInvoiceApproved) whichSubject = "Currency" addNew = False Flow_0bipj9q Flow_061sv6t find_user = current_user["username"] isCurrentUser = True Flow_1vxagrf Flow_0bipj9q DataObjectReference_05liqvr Flow_1vxagrf # Check if commenet field was initialized if 'commentSubmitter' not in invoice: invoice['commentSubmitter'] = '' # Determine length of Submitter's comments len_submitter_comment = len(invoice["commentSubmitter"].strip()) # Initialize Comment Lengths to 0 len_submitter_comment = 0 len_project_lead_comment = 0 len_finance_comment = 0 # Preview form fields invoice = {} invoice["contributorName"] = current_user_extras["full_name"] invoice["contributorId"] = current_user_extras["bamboo_api_id"] Flow_17vkjgc Flow_02moyg7 Flow_1ck27i7 Flow_1x4rtop Flow_05ffq52 Flow_02moyg7 Flow_1ck27i7 DataObjectReference_0bymrvr Flow_1avkxpe Flow_18i6dlo Flow_1d7sgm2 invoice_date_obj = datetime.strptime(invoice.dueDate, '%Y-%m-%d') local_date_time_obj = datetime.strptime(local_date_str, '%Y-%m-%d') if invoice_date_obj > local_date_time_obj: svc_is_due_date_after = True else: svc_is_due_date_after = False # Add date of invoice invoice["invoiceDate"] = local_date_str ld = str(local_date_time_obj) ido = str(invoice_date_obj) del local_date_time_obj del invoice_date_obj del datetime Flow_04odmtl {"invoice.contributorName": "Harmeet"} { "isNameNum": false, "invoice.contributorName": "Harmeet" } Flow_1avkxpe Flow_0mvmd06 svc_is_num_in_name = False for c in invoice.contributorName: if c.isdigit(): svc_is_num_in_name = True break del c Flow_0mvmd06 Flow_0wp2mcf # Check if there are more than two decimal places invoiceAmount_str = str(invoice.invoiceAmount) d = decimal.Decimal(invoiceAmount_str) d_cnt = d.as_tuple().exponent # Get number of decimal places svc_decimal_cnt = abs(d_cnt) #Delete unneeded variables del d del d_cnt del decimal Submit_Involce_Validation Flow_1d7sgm2 Flow_0tzjowk Flow_0wp2mcf Flow_18i6dlo Flow_0tzjowk Flow_04odmtl is_num_in_name = svc_is_num_in_name is_decimal_cnt = (svc_decimal_cnt >= 2) is_due_date_before - not(svc_is_due_date_after) val_list = [is_num_in_name, is_decimal_cnt, is_due_date_before] val_list_cnt = val_list.count(True) if val_list_cnt > 1: if val_list_cnt == 2: val_list_cnt_str = "Two" if val_list_cnt == 3: val_list_cnt_str = "Three" # Set Invoice Status if svc_is_invoice_submit_pass: invoice["invoiceStatus"] = "Awaiting approval" else: invoice["invoiceStatus"] = "Invoice validation failed" Process milestone should update the process metadata field “milestone reached” Flow_05ffq52 Flow_13ng1f4 Flow_1pefcgv Flow_061sv6t Flow_0adpna9 Flow_17vkjgc {{ submitInvoiceValidationMessage }} **Please fix when resubmitting.** Flow_13ng1f4 Flow_18cic3h curCode = invoice.invoiceCurrency curAmount = invoice.invoiceAmount isCurTest = False invoice.invoiceAmount_str = curAmount_str Flow_1x4rtop Flow_06amgv2 Flow_18cic3h Flow_1pefcgv # CLear Contributor Name if contains number if svc_is_num_in_name: invoice["contributorName"] = None # Clear Invoice Anount if more than 2 decimals if svc_decimal_cnt > 2: invoice["invoiceAmount"] = None # Clear Invocie Due Date if before Today's Date if not(svc_is_due_date_after): invoice["dueDate"] = None Flow_0z51hpb Flow_1xvt99y Flow_0adpna9 ___ | **Field** | **Input** | | ---: | :--- | |_Submitted by:_ | {{ invoice.contributorName }} | |_Submitter Id:_ | {{ invoice.contributorId }} | |_Invoice Id:_ | {{ invoice.invoiceId }} | |_Amount:_ | {{ invoice.invoiceAmount_str }} | |_Submitted on:_ | {{ invoice.invoiceDate }} | |_Due Date:_ | {{ invoice.dueDate}} | ___ {% if len_submitter_comment > 0 %} *{{ current_user_extras["full_name"] }} comments:*. {{ invoice["commentSubmitter"] }} ___ {% endif %} Thank you for your invoice submission. Updates on the progress of your submission will be sent to you on the Status app. Please click Submit below to return to the Home page. __________________________________________________________________________ # Set Proceed to True isProceed = True Flow_06amgv2 Flow_0z51hpb not(isProceed) Process milestone should update the process metadata field “milestone reached” Flow_04fl87d Flow_1ex5hfx Flow_1c5u447 Flow_1gohkts Flow_16bw9hx Flow_16bw9hx Flow_0kngdw4 Flow_1gohkts Flow_04ccp12 Flow_00kky3k Flow_15pzvrr Flow_18xvx8w Flow_0bfs2xe # Check Finance Comment invoice['commentFinance'] = approvalComment # Reset Approval Comment approvalComment = "" # Check for Finance comments len_finance_comment = len(invoice["commentFinance"].strip()) # Set Invoice Status if isInvoiceApproved: invoice["invoiceStatus"] = "Approved by Finance Team" invoice["isFinanceApprove"] = True else: invoice["invoiceStatus"] = "Rejected by Finance Team" invoice["isFinanceApprove"] = False **Invoice Id:** {{ invoice.invoiceId }} ___ | **Field** | **Input** | **Field** | **Input** | **Source** | **Amount** | | ---: | :--- | ---: | :--- | ---: | :--- | |_Submitted by:_ | {{ invoice.contributorName }} | _Submitted on:_ | {{ invoice.invoiceDate }} | _Requested:_ | {{ invoice.invoiceAmount_str }} | |_Submitter Id:_ | {{ invoice.contributorId }} | _Due Date:_ | {{ invoice.dueDate}} | _Bamboo Monthly Salary:_ | {{ monthly_salary_str }} | ___ {% if len_submitter_comment > 0 %} *{{ current_user_extras["full_name"] }} comments:*. {{ invoice["commentSubmitter"] }} ___ {% endif %} {% if len_project_lead_comment > 0 %} *{{ project_lead_info["full_name"] }} comments:* {{ invoice["commentProjectLead"] }} ___ {% endif %} approvalComment = "" Flow_1ds4s8o Flow_070r5mq Flow_1v8dszb Flow_1w4cqkv # Set Timer Check isApprovalTimer = True Flow_1w4cqkv Flow_09r1s5r Flow_1qf14hx Flow_0c0c9mw Flow_1xo0lvm Flow_15pzvrr # Store Team Lead comments elsewhere and clear form comments if isApprovalTimer: invoice["commentProjectLead"] = "No action taken within allotted time" approvalComment = "" invoice["isProjectLeadApprove"] = False isInvoiceApproved = False # Set Invoice Status invoice["invoiceStatus"] = "Rejected" else: invoice["commentProjectLead"] = approvalComment approvalComment = "" invoice["isProjectLeadApprove"] = isInvoiceApproved # Set Invoice Status invoice["invoiceStatus"] = "Approved" Flow_14glsqd Flow_0hev3yn Flow_1s2as7o Flow_0hyvwku Flow_0o94g4u Flow_02o270g Flow_0o94g4u Flow_0a9w301 Flow_1s2as7o Flow_0hyvwku invoice_file_name = invoice.contributorName + "_" + str(invoice.invoiceId) + ".pdf" Flow_0hev3yn Flow_02o270g Flow_0hrln7l Flow_14glsqd Flow_0a9w301 Flow_0cj1m0h del(filesAccept) Flow_0eqkrc3 Flow_00kky3k Flow_0h96w9j Flow_0hws1pe Flow_1cwebky Flow_1fvtcqt # check if Project Lead Comments len_project_lead_comment = len(approvalComment.strip()) # Set Timer Check isApprovalTimer = False # Set Comment Default approvalComment = "" **Invoice Id:** {{ invoice.invoiceId }} ___ | **Field** | **Input** | **Field** | **Input** | **Source** | **Amount** | | ---: | :--- | ---: | :--- | ---: | :--- | |_Submitted by:_ | {{ invoice.contributorName }} | _Submitted on:_ | {{ invoice.invoiceDate }} | _Requested:_ | {{ invoice.invoiceAmount_str }} | |_Submitter Id:_ | {{ invoice.contributorId }} | _Due Date:_ | {{ invoice.dueDate}} | _Bamboo Monthly Salary:_ | {{ monthly_salary_str }} | ___ {% if len_submitter_comment > 0 %} *{{ current_user_extras["full_name"] }} comments:*. {{ invoice["commentSubmitter"] }} ___ {% endif %} Flow_0lfqk0y Flow_09r1s5r Flow_0h96w9j Flow_1cwebky DataObjectReference_1g4gzsx Flow_1xvt99y Flow_0hrln7l timedelta(seconds=1) Flow_1qf14hx Flow_1xo0lvm timedelta(seconds=1) Flow_070r5mq Flow_0eqkrc3 timedelta(seconds=1) Flow_0bfs2xe Flow_0c0c9mw DataObjectReference_1wclgyx Flow_14x1v12 Flow_0k8m0l1 Flow_1bnxkd6 Flow_01i59kw Flow_1bnxkd6 Flow_01i59kw Flow_14x1v12 Flow_0k8m0l1 # Set which message and check if there are Project Lead and/or Finance comments if isApprovalTimer: task_id = "waku_no_team_lead_response" else: if isMatch: len_finance_comment = len(invoice["commentFinance"].strip()) len_project_lead_comment = 0 task_id = "waku_invoice_rejected_ismatch" else: if invoice["isProjectLeadApprove"]: task_id = "waku_invoice_rejected_not_ismatch_pl_approve" else: task_id = "waku_invoice_rejected_not_ismatch_not_pl_approve" len_finance_comment = 0 # Set Message should not be set isSetMessage = True # Set Time Zone time_zone = current_user_extras["time_zone"] # Set Time Format time_format = current_user_extras["time_format"] # Set Date Format date_format = current_user_extras["date_format"] Flow_0kngdw4 Flow_0lfqk0y Flow_0dvboik Flow_0y37dgj # Set who for find find_user = userKeycloak isCurrentUser = False # Set Project Lead Info project_lead_info = {} project_lead_info["full_name"] = userFullName project_lead_info["first_name"] = userFirstName project_lead_info["email"] = userEmail project_lead_info["time_zone"] = userTimeZone project_lead_info["time_format"] = userTimeFormat project_lead_info["date_format"] = userDateFormat project_lead_info["status_key"] = userStatusKey # Move to pre-script of Waku Message # Set Time Zone time_zone = project_lead_info["time_zone"] # Set Time Format time_format = project_lead_info["time_format"] # Set Date Format time_format = project_lead_info["date_format"] # del(userFullName) # del(userFirstName) # del(userEmail) # del(userTimeZone) # del(userTimeFormat) # del(userDateFormat) # del(userStatusKey) Flow_0bv17h4 Flow_0gplgyz Flow_0re50gq Flow_0y37dgj # Set Waku message variables task_id = "waku_notify_project_lead" isSetMessage = True Flow_0gplgyz Flow_0re50gq Flow_0dvboik Flow_01ki4jt userBambooId_str = current_user_extras["bamboo_supervisor_api_id"] Flow_01ki4jt Flow_0bv17h4 Flow_18xvx8w Flow_04ccp12 Flow_1ds4s8o DataObjectReference_0x2dn5o Flow_11zkgke # Set Task Id task_id = "waku_notify_finance" # Set Message should not be set isSetMessage = True isInvoiceApproved = "" Flow_0u8sn4c Flow_0n3djvs Flow_0lr2fpj Flow_0n3djvs Flow_0lr2fpj Flow_11zkgke Flow_1ale8a2 # Get Finance Group Members finance_members_start = get_group_members("Finance Team") finance_members = finance_members_start # Removed all but Sasha for demo for member in finance_members: if member != "alex": finance_members.remove(member) # Set who for find find_user = 'alex' isCurrentUser = False # Set Project Lead Timer Check to False to determine which message to send later isApprovalTimer = False Flow_1ale8a2 Flow_1gfeknb Flow_1gfeknb Flow_0u8sn4c # Set Project Lead Info finance_info = {} finance_info["full_name"] = userFullName finance_info["first_name"] = userFirstName finance_info["email"] = userEmail finance_info["time_zone"] = userTimeZone finance_info["time_format"] = userTimeFormat finance_info["date_format"] = userDateFormat finance_info["status_key"] = userStatusKey # Move to pre-script of Waku Message # Set Time Zone time_zone = finance_info["time_zone"] # Set Time Format time_format = finance_info["time_format"] # Set Date Format time_format = finance_info["date_format"] del(userFullName) del(userFirstName) del(userEmail) del(userTimeZone) del(userTimeFormat) del(userDateFormat) del(userStatusKey) Flow_0cj1m0h Flow_04fl87d DataObjectReference_1ykzuco Flow_1yktpsd Flow_17xbb2s Flow_0j4xxzp Flow_17xbb2s # Set Task List task_id = "waku_invoice_submitted" # Set Message should be generated isSetMessage = True # Set Time Zone time_zone = current_user_extras["time_zone"] # Set Time Format time_format = current_user_extras["time_format"] # Set Date Format time_format = current_user_extras["date_format"] Flow_1yktpsd Flow_0j4xxzp Flow_1ex5hfx Flow_1c5u447 Flow_1sc1v4y Invoice_Approval_Check Flow_1m8uxeg Flow_04do8x7 Flow_02g4qn2 Flow_0nxzc38 annual_salary_str = resp_BambooPayRate["amount"] annual_salary = float(annual_salary_str) monthly_salary = annual_salary/12 Flow_0xtzqkg Flow_1m8uxeg invoice_amount = invoice.invoiceAmount Flow_04do8x7 Flow_18i75ep Flow_0xtzqkg Flow_1sc1v4y Flow_02g4qn2 Flow_0nxzc38 Flow_10c1gm6 curCode = invoice.invoiceCurrency curAmount = monthly_salary isCurTest = False monthly_salary_str = curAmount_str Flow_10c1gm6 Flow_18i75ep # Set Invoice Status to Approved and Pending Payment invoice["invoiceStatus"] = "Approved and Pending Payment" Flow_1fvtcqt Flow_0hws1pe DataObjectReference_0br9o6c Flow_1j5eznh # Set Task Id and Project Lead comments length if isMatch: task_id = "waku_payment_pending_ismatch" len_project_lead_comments = 0 else: task_id = "waku_payment_pending_not_ismatch" len_project_lead_comments = len(invoice["commentsProjectLead"].strip()) # Set Message in Call Activity isSetMessage = True # Set Time Zone timezone = current_user_extras["time_zone"] Flow_1j5eznh Flow_1w7kqay Flow_1buk0a2 Flow_1w7kqay Flow_1buk0a2 Flow_1v8dszb timedelta(minutes=5) topica_one topica_one { "topica_one": "Invoice successfully submitted" }