How can I trigger a contact workflow on a specific date in Bitrix24? - triggers

I would like to trigger a workflow resetting a sum on all contacts every 1st January of the year. The workflow is implemented. It could be triggered on the specific date or even everyday, because the date is verified in the workflow before resetting.
How can i run it on every contact?

Hello and welcome to Stackoverflow, the answer to your question is as the following:
You need to create a Rest API outbound webhook in your Bitrix account with "CRM" & "Business Process" permissions.
You will write down a PHP code that will be executed on the exact date/time of you choice
The PHP script will do 2 process:
Will retrieve all the contacts that you have on your Bitrix account and store them into a string value.
It will run that Business process and pass the list of all the found contacts, and inside your Business process you're going to set it up in a way that it will run the required actions on every contact from eh contacts IDs passed by the first step.
The PHP script can be hosted in a webhosting or even on your local machine since it's once a year.
This is only the concept of the solution, I can't share the script code because I don't have it at the moments, please contact me if you faces problems.

Related

Platform / extranet suggestions for capturing data from external sales agents

I'm looking for suggestions for a tool/platform that can help in capturing form and file attachment data from external sales agents. I currently use Google Forms and a plugin to enable sending email notifications to specific contacts, but the hope is to create something more advanced where people providing the data can login to submit data and make updates to the records. The platform should also enable approval workflows with email notifications to ensure the incoming data meets requirements.
Here is a description of the desired process:
Agent logs in to the platform
Agent submits data (and optional file attachments) into the system using a form
Upon submission, the system triggers a review task and sends an email notification to a reviewer
If the reviewer deems the information invalid/incomplete, they will
reject it, with comment, and the system will
automatically send the information back to the agent while copying
their manager. Record status will be updated automatically.
If the reviewer deems the information invalid, they will approve it, with or without
comment, and the system will automatically send the information back to the agent while copying
their manager and project administrator. Record status will be updated automatically.
Additional requirements:
Contacts for email notifications will vary by agent and they should be determined by identification items on the user/agent profile
Agents need to be able to update records but a new review task will be triggered once an update is submitted
The system should have functionality for searching the record fields
An agent should see their own data and data submitted by others in the same agency, but not the data submitted by agents outside their agency
I should be able to see the full list of submissions and version history of the records
Approximate scale: 100-150 agencies, 1000-1500 agents
So far, I've thought of using a list within SharePoint Online combined with Microsoft Flow, but I'm not sure it would enable all the desired functionality. I'd be interested in your thoughts about that setup as well as others that you think could work and/or have found successful. Even if your solution does not tick all the boxes, I'd be interested to know about it.
Thanks a lot for your help!
JP

Automating SharePoint Online access for External Users through Flow/Azure

I'm quite new to SharePoint/Azure/PowerShell, so apologies if what I'm asking is a stupid question!
We currently have client SharePoint sites hosted on our O365 tenant, with access to each site to be rolled out to each of our respective clients shortly. Initially, only the senior management of each client will have access to the sites, however as time goes on it's likely we'll be adding everyone else too; To streamline the new user process and save us from having to add each individual staff member, we've been considering using a Flow to automate user access instead, with the goal of adding authenticated external users without much real input from administrators other than a simple approval/rejection process.
The overall plan is as follows:
Visio Outline<
Each Client site has a SharePoint Custom List, titled "Employee Access List". Said list will have the following columns: Request ID (Text), First Name (Text), Last Name (Text), Job Title (Text), Company (Text), Contact Number (Text), E-Mail (Text), SharePoint Access (Yes/No Boolean).
If a member of staff requires access to the SharePoint site, then their respective manager will add the staff member to the list and fill in all the above fields, setting the "SharePoint Access" item value to "Yes".
This will trigger the flow and an approval email to be sent to myself and another administrator, with said email detailing the user to be created, and who has submitted the request.
Script insertion somehow - This would then run if the request was approved, and set the user up with access.
Email notification is automatically then sent to the creator of SharePoint list item, notifying them that the user now has access.
Step 4 is where I'm a little stuck in regards to what to do if the request is approved - I've written a little PowerShell script below which nearly achieves what I'm going for, in that it creates an external user PnP Group and PnP Role Definition (If there isn't one already), pulls what's in the "E-mail" fields on the "Employee Access" list and runs Add-PnPUsertoGroup to pull the users to the PnP group, which then sends the users an email with a link to the SharePoint site, allowing them to access it. However:
The script I've written targets everyone on the SharePoint List, whereas ideally I would just want the script to target the sole user that's been newly added to the list/is listed in the approval email, and only them. I'm assuming that I'd have to pipe information from the Flow into a script, which I'm not even sure is possible, and if it is, I haven't got a clue how to do it.
I know that that Azure Functions and Azure Automation can be used to insert scripts into Flows, but I don't have experience of either so I'm not sure which is the more suitable option. Is there any guidance on how to insert PowerShell scripts with them, and how to pipe what's in a flow into said scripts?
PowerShell Script as follows:
Hope this all makes sense - Any guidance would be appreciated.
Thank you!
EDIT:
Just as a bit of extra information, here is the Flow as it currently is:
Flow Part 1
Flow Part 2
Flow Part 3
Have since found an answer to the above - whilst Azure Functions/Automation are an option, you don't necessarily need them or PowerShell scripts running from Flow, in this case my goal scenario was achieved using an MS Graph Invitation API, App Permissions and a HTTP SharePoint call instead.
See attached screenshots:
Flow Answer 1
Flow Answer 2
Flow Answer 3
Step 1: Set up an App with permissions to make calls to MS Graph - use this guide for help on how to do so - http://blogopaxio.azurewebsites.net/accessing-graph-api-from-microsoft-flow-using-application-permissions-2/
Step 2: Add HTTP to MS Graph and set parameters as in screenshot 1 of this post - this action will create guest user and invitation URL the user would need to sign in to the site.
Step 3: At this point, run the flow so that we can get the 'inviteRedeemURL' from the body of the Output for the HTTP step - you will need this particular URL to send separately in your email to the end user.
Step 4: Throw in a pause for a minute or 2 just to make sure that the information from the previous actions 'sticks' - provided it all works, at this point, the user will actually have their guest account created and you'll be able to see them under Users in your O365 admin centre, however they won't be aware of their account access yet (We'll notify them of this in our email at the end).
Step 5: Add the user to SharePoint security group with a "Send HTTP Request to SharePoint" action. Please note that the "sitegroups(19)" in the URI of this action refers to the ID number of the PnP group you're putting them in, so in my case the group ID was 19. If you're unsure of the ID of your group, connect to your SharePoint Site through PowerShell with PnP commands, then run Get-PnPGroup.
Step 6: Send the email to the invited user with the Outlook Send Email action - FYI -the "SharePoint Site" variable in my screenshot is actually the "inviteRedeemURL".
Hope this helps anyone else that's unsure of how to do this. If anyone has a better solution that achieves this by all means post it!
Thanks!

Sending Emails from different accounts with Google App Script

I have generated the codes with app script in order to send emails automatically if users changed some values in google spreadsheet, which is working fine.
Now I am sharing my google spreadsheet with the app script to two more person (e.g: PersonA, PersonB). Thus, I want whoever changes anything on google spreadsheet will be sending an email under his/her own account. E.g: [All of us needs to edit within the google spreadsheet itself, without going to the "current web app url", (thanks Cameron Roberts for the clarification] if PersonA changes anything, then an email will be sent out under PersonA's account, and an email will be sent out under PersonB's account if PersonB changes anything.
I did something based on the advice from user2970721 and Cameron Roberts. I adjusted "Deploy web App" as "User accessing the web app". e.g:
I also asked PersonA & PersonB to do the same under their accounts and made sure they have triggered the script at least once. e.g:
My issue is that after I have done all these mentioned above, no matter who changes anything on google spreadsheet, emails were always sent out from PersonB's account (my best guess is that I messed up something and PersonB was the last one who triggered the script).
Does the "Project version" need to be different for me, PersonA, and PersonB, or anything else I need to change? Any help would be greatly appreciated!
First, Your project versions do not need to be different for each user.
I'm assuming you are using the On Change event, rather than a web-app. If that's the case, you should disable the WebApp entirely, as it's not needed.
When PersonA creates an On Change trigger, that will be triggered anytime any user (eg PersonA or PersonB) edits the spreadsheet. When it is triggered the code will execute as PersonA , because PersonA created the trigger. As a result, the email will be sent from PersonA's account.
For the scenario you describe, where both PersonA and PersonB have created OnChange triggers and authorised the script. I would expect emails to be sent from both accounts that have created triggers.
To send only one email, from the account that did the edit, I think you would need to do a check to determine if the user who did the edit matches the user under who's authority the script is running. I've never done this before and the docs don't really make it clear if it's possible.
Try checking the User object (Eg e.user) included with the Change event, and see if that email address is reflecting the different users making the edits.
If it is, you can compare it with the effective user and send the email if they match.
https://developers.google.com/apps-script/reference/base/user
https://developers.google.com/apps-script/reference/base/session#getEffectiveUser()
Finally, it might be simpler to just include the address of the person making the edit in your email subject, and just have all the emails send from one account. That way you know who made the edit, but don't need to have every user create a trigger and do all the extra checking.

Dynamics CRM Workflow: Verifying that Item is assigned to a User (vs. Team) Before Sending Notification

I have reviewed all the past questions as well as scoured google results, but I can't find a good answer to this.
In our MS Dynamics CRM 2016 Cloud implementation, we have added email notifications to the owner of a Lead, or Opportunity, based on certain events. Sometimes the owner is a Team, and in those cases, we want to avoid sending to the team (it causes the workflow to get stuck in "waiting for retry based on error").
I added a qualification to all the workflows to say: If OwningUser.PrimaryEmail Contains Data ...
My theory was that if a user were associated with the Owner field, this would pass (all of our users have primary emails except service accounts), and if a team were associated, it would fail. However, that is not happening - it is still trying to send the email and failing.
I was concerned that it could be an issue if no user were assigned and the system tried to reference a null value.
However, I can't see another way to do this and no one I've talked to seems to know either.
Try adding a condition like this. This should hopefully tell you if the owner is populated with a team record, if not then you are safe to send the email.

How to update target list dynamically?

I am using the Community Edition. Daily I add new leads to the Sugar CRM database. We send newsletters using target lists. How can I update the target lists automatically before to start the emailing process? Ideally I would like to use a SQL statement or a report as a source of e-mail addresses for the emailing process. Is it possible?
The workflow is:
The user fill a order in our web. I need to add the record to the SugarCRM database.
According the user profile, he/she is assigned to a different target list. There are 4 target lists according the user profile.
Then, according the profile, the user will receive a different group of emails at 7, 15, 30 and 90 days from the registration date.
As I explain, a static target list does not work here because each day different users enroll in the system and the emailing schedule for each user depends on the date of registration.
I am trying to discover how to add directly via php to create dynamically a target list and then to launch the campaign but I am not sure if there is a better way.
I have found the solution. It is pretty simple. I only need to fill via sql the emailman table. I do not need to fill targets lists or similar.