<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mateen Ahmed on Medium]]></title>
        <description><![CDATA[Stories by Mateen Ahmed on Medium]]></description>
        <link>https://medium.com/@mateen462?source=rss-88738f0b5808------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*HI1C8yALJFQdtqyYsFwVzw.jpeg</url>
            <title>Stories by Mateen Ahmed on Medium</title>
            <link>https://medium.com/@mateen462?source=rss-88738f0b5808------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 13:50:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mateen462/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[D365Fo: Replacement Key in Tables and its usage]]></title>
            <link>https://medium.com/@mateen462/d365fo-replacement-key-in-tables-and-its-usage-97e384d65b13?source=rss-88738f0b5808------2</link>
            <guid isPermaLink="false">https://medium.com/p/97e384d65b13</guid>
            <category><![CDATA[d365-fo]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[finance-and-operations]]></category>
            <dc:creator><![CDATA[Mateen Ahmed]]></dc:creator>
            <pubDate>Wed, 08 May 2024 08:47:29 GMT</pubDate>
            <atom:updated>2024-05-08T08:47:29.203Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*4gNpMdaBExw430S12_00gA.png" /></figure><p>Ever wondered what purpose the Replacement key serves and how we can use it in our development?</p><p>I learned about it yesterday and thought should share more about it.</p><p>When we have a parent-child relationship or any other relationship, we can use recid to join the two tables. Having said that, showing the recid in the front end isn’t really beneficial we can link that recid to show some meaningful information for that record to the user.</p><p>For example, We have a parent table, having First Name and Last Name fields. And we have a child table saving the recid of the parent table as a reference.</p><p>We can use the Replacement key for this purpose and it is quite easy. Let us implement this.</p><p>In the parent table, create a new index with the fields you want to show in the lookup of the child form. In my case I want the first name and last name to be displayed in the lookup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*dC8SfgP78ZhgjQ9gFHRhUQ.png" /><figcaption>Parent Table Index</figcaption></figure><p>The index properties are the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/332/1*OZ9oPQxA9jHZ50aNiDPodA.png" /></figure><p>Next, in the table properties, define this index as a Replacement index.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/407/1*7IjeoF1WhxuotOLfnQFJuA.png" /></figure><p>The parent table is set up. Now we will move on to the child table. There we will have an int64 field to make a relationship with the recid of the parent table. Then we will create the relationship.</p><p>For the field, we will have the extended data type of refrecid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/331/1*Jph6SFJlI-c0evUc5tkVgg.png" /><figcaption>Field Properties</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*Sh4fa_vvvoWFRscsReH7AA.png" /><figcaption>Relation</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/1*T7JcHui2rJWRym4rSGYYeA.png" /><figcaption>Relation Properties</figcaption></figure><p>Now, while setting up the form of the child table, just drag and drop the refrecid field (in my case it is named ParentTable). This will create a reference group field. And we are all set up!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*KNJpNUabOaWBndwYNjkuqA.png" /><figcaption>Reference Group field in Grid</figcaption></figure><p>My Parent Table has the following values:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*O3cyy9Tp5iZhqSzZnoneOw.png" /><figcaption>Parent Table</figcaption></figure><p>When I open the child form, and click on the lookup button, it shows me all the First Name and Last Name:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*cFkMwpXC_uAX9B2E3hFNuQ.png" /><figcaption>Child Form</figcaption></figure><p>This is done. We have implemented Replacement Key and Reference Group! Happy Learning.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97e384d65b13" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[D365fo: Make fields mandatory according to User's Role]]></title>
            <link>https://medium.com/@mateen462/d365fo-make-fields-mandatory-according-to-users-role-367530c796c4?source=rss-88738f0b5808------2</link>
            <guid isPermaLink="false">https://medium.com/p/367530c796c4</guid>
            <category><![CDATA[d365-fo]]></category>
            <category><![CDATA[finance-and-operations]]></category>
            <category><![CDATA[mandatory]]></category>
            <category><![CDATA[dynamics-365]]></category>
            <dc:creator><![CDATA[Mateen Ahmed]]></dc:creator>
            <pubDate>Tue, 06 Feb 2024 14:23:17 GMT</pubDate>
            <atom:updated>2024-02-07T04:40:02.267Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ir18ujqPmXBT_u_LJ2bSIg.jpeg" /></figure><p>Sometimes, we want that if a user logs in with a certain role, the fields in the form are mandatory otherwise the fields are non-mandatory.</p><p>Certainly, we can make the fields editable with Roles and Privileges, but to make fields mandatory for a certain role, we have to write code in the form methods.</p><p>It is better if we write the code in the init method. Here’s the code for it:</p><pre>public void init()<br> {<br>   super();<br>  <br>   SecurityRole role;<br>   SecurityUserRole userRole;<br>   UserInfo userInfo;<br>   select role<br>   exists join userRole<br>   where role.RecId == userRole.SecurityRole<br>   &amp;&amp; userRole.User == curUserId() <br>   &amp;&amp; role.AotName == &#39;CustomUserRole&#39;<br>    //Change the name of the AOT role<br>   {<br>     CustomTable_CustomField.mandatory(true);<br>   }<br><br> }<br></pre><p>Make sure that in the form control for which you want to make the field mandatory, auto declaration is set to yes.</p><p>Happy Learning!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=367530c796c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[D365fo: Multi-select lookup in Form Control with range applied]]></title>
            <link>https://medium.com/@mateen462/d365fo-multi-select-lookup-in-form-control-with-range-applied-0b5b8d12e54f?source=rss-88738f0b5808------2</link>
            <guid isPermaLink="false">https://medium.com/p/0b5b8d12e54f</guid>
            <category><![CDATA[d365-fo]]></category>
            <category><![CDATA[dynamics-365]]></category>
            <category><![CDATA[customization]]></category>
            <category><![CDATA[forms]]></category>
            <category><![CDATA[finance-and-operations]]></category>
            <dc:creator><![CDATA[Mateen Ahmed]]></dc:creator>
            <pubDate>Thu, 01 Feb 2024 08:21:36 GMT</pubDate>
            <atom:updated>2024-02-01T08:21:36.648Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AqkD_p7khh26ZZpVwSuTMA.jpeg" /></figure><p>We find many articles helping us to build a lookup on a form control, but it is a big hassle to implement a multi-select lookup on a custom control. Today we will learn how to have a lookup which helps us select multiple values at once. Here’s the code:</p><pre> public void MultiSelectLookup(FormStringControl _control)<br>{<br><br>    // Declare variables for QueryBuildDataSource, and Container<br>    QueryBuildDataSource DS;<br>    Container cont;<br><br>    // Add a data source to the query based on the table number of CustomTable<br>    DS = query.addDataSource(tableNum(CustomTable));<br>    <br>    // Add a range to the data source, filtering records where CustomGroup field equals &#39;13&#39;<br>    DS.addRange(fieldNum(CustomTable, CustomGroup)).value(&#39;13&#39;);<br>    <br>    // Add the Id field of CustomTable as a selection field in the query<br>    DS.addSelectionField(fieldNum(CustomTable, Id));<br>    <br>    // Use SysLookupMultiSelectGrid to open a multi-select lookup based on the provided query and control objects<br>    SysLookupMultiSelectGrid::lookup(query, _control, _control, _control, cont);<br>}</pre><p>Hope this helps you out in your development. Please let me know if you have any questions! Cheers</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0b5b8d12e54f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[D365fo: Opening Dialogue form through X++]]></title>
            <link>https://medium.com/@mateen462/d365fo-opening-dialogue-form-through-x-1c8f73792e0d?source=rss-88738f0b5808------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c8f73792e0d</guid>
            <category><![CDATA[finance-and-operations]]></category>
            <category><![CDATA[erp]]></category>
            <category><![CDATA[dynamics-365]]></category>
            <dc:creator><![CDATA[Mateen Ahmed]]></dc:creator>
            <pubDate>Wed, 13 Dec 2023 13:30:25 GMT</pubDate>
            <atom:updated>2023-12-13T13:30:25.646Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7NVmGVQwXxuYouj2XHyiSQ.jpeg" /></figure><p>Sometimes, there is a requirement to implement the dialogue form and then use the values in some functionality. We can directly open the form with X++. Here’s how:</p><p>If we have a button on the form for example, and we need to open up a dialogue form, we can write the following code inside the clicked method of that button:</p><pre>void clicked()<br>        {<br>            Dialog d;<br>            DialogField id;<br>            DialogField name;<br>            str   ReasonCategory , ReasonDetails;<br>            FormStringControl           control;<br>            FormBuildStringControl controll;<br>           <br>           <br>             super();<br>        <br>             d = new Dialog(&quot;Testing Dialog&quot;);<br>             category = d.addField(extendedtypestr(ReasonCodeEDT ), &#39;Inactivation Reason&#39; );<br>             Details = d.addField(extendedTypeStr(TXT ), &#39;Category&#39; )                ;<br><br><br><br>            if(d.run())<br>            {<br>               ReasonCategory  =       category.value();<br>               ReasonDetails   =       Details.value();<br>               // Implement business logic here<br>            }<br>        }</pre><p>This will open up a new dialog form and implement any business logic too! Happy Learning.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c8f73792e0d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[D365Fo: Code for Resubmitting the workflow]]></title>
            <link>https://medium.com/@mateen462/d365fo-code-for-resubmitting-the-workflow-095b9892dffe?source=rss-88738f0b5808------2</link>
            <guid isPermaLink="false">https://medium.com/p/095b9892dffe</guid>
            <category><![CDATA[d365-fo]]></category>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[dynamics-365]]></category>
            <dc:creator><![CDATA[Mateen Ahmed]]></dc:creator>
            <pubDate>Fri, 24 Nov 2023 11:16:12 GMT</pubDate>
            <atom:updated>2023-11-24T11:16:12.411Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P-VKHlJQZwGEWIK8f9D9aw.jpeg" /></figure><p>When we are implementing the workflow of D365fo, the Resubmit Manager Class is automatically created, and oftentimes, we forget to write the code to implement its logic.</p><p>Let’s explore the code for resubmitting the workflow:</p><pre>public static void main(Args args)<br> {<br>        recID recID = args.record().RecId;<br>        tableId tableId = args.record().TableId;<br><br>        Table Table = args.record();<br>       <br>        WorkflowWorkItemTable workItem = args.caller().getActiveWorkflowWorkItem();<br>        WorkflowWorkItemActionDialog workflowWorkItemActionDialog;<br><br>        if (workItem.RecId &gt; 0)<br>        {<br>            try<br>            {<br>                workflowWorkItemActionDialog = WorkflowWorkItemActionDialog::construct(workItem, WorkflowWorkItemActionType::Resubmit, new MenuFunction(args.menuItemName(),args.menuItemType()));<br>                workflowWorkItemActionDialog.run();<br><br>                if (workflowWorkItemActionDialog.parmIsClosedOK())<br>                {<br>                    // Condition is Rejected because Status is changed in Returned inside Approval Event Handler.<br>                    if ( Table.WorkflowStatus == WorkflowStatus::Rejected)<br>                    {<br>                        workItem = args.caller().getActiveWorkflowWorkItem();<br><br>                        WorkflowWorkItemActionManager::dispatchWorkItemAction(workItem, workflowWorkItemActionDialog.parmWorkflowComment(), workflowWorkItemActionDialog.parmTargetUser(), WorkflowWorkItemActionType::Resubmit,<br>                        args.menuItemName());<br>                        // Change the WFStatus to Submitted.<br>                        Table.WorkflowStatus= WorkflowStatus::Submitted;<br>                        ttsbegin;<br>                        Table.dataSource().write();<br><br>                        ttscommit;<br>                        info(&quot;@Label:ResubmittedToWorkflow&quot;);<br><br>                    }<br>                    else<br>                    {<br>                        throw Exception::Error;<br>                    }<br>                }<br>            }<br><br>            catch(Exception::Error)<br>            {<br>                throw error(strfmt(&quot;@Label:ResubmitError&quot;));<br>            }<br>        }<br>        // Make the form refresh its common workflow UI controls.<br>        args.caller().updateWorkflowControls();</pre><p>Then will reassign the workflow for approval and change the status of the Workflow to Submitted. You may customize the code further according to the business logic. Hope it helps out!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=095b9892dffe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[D365FO: Apply range to form’s data source depending on Menu Item’s Name]]></title>
            <link>https://medium.com/@mateen462/d365fo-apply-range-to-forms-data-source-depending-on-menu-item-s-name-c6e5bc2a487a?source=rss-88738f0b5808------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6e5bc2a487a</guid>
            <category><![CDATA[d365]]></category>
            <category><![CDATA[dynamics-365]]></category>
            <category><![CDATA[d365-fo]]></category>
            <dc:creator><![CDATA[Mateen Ahmed]]></dc:creator>
            <pubDate>Fri, 17 Nov 2023 06:07:46 GMT</pubDate>
            <atom:updated>2023-11-17T06:07:46.313Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4W_A4XzJlPV88l9s2tB-Gw.jpeg" /></figure><p>It is possible that we want to apply ranges to the form data source depending on which menu item was used to open the form.</p><p>For example, we can have All Projects and Approved Projects. They would have the same form but Approved Projects would only show the data which has been approved. Let’s explore how we can achieve this.</p><p>Create two menu items i.e. AllProjects and ApprovedProjects, both of which will open the same form. Write now if you build the project it will show exactly the same data because we have not applied any range till now.</p><p>In the form’s data source methods, extend the init method. Then write the following code:</p><p>Note: In my case, the menu item name is ApprovedProjects, Datasource inside the form is Projects, and Field inside the table for which I want to apply the range for WorkflowStatus.</p><pre>public void init()<br>        {<br>            super();<br>            if(element.args().menuItemName() == menuItemDisplayStr(ApprovedProjects))<br>            {<br>                this.query().datasourcetable(tablenum(Projects)).addrange(fieldnum(Projects,WorkflowStatus)).value(queryValue(enum2Str(WorkflowStatus::Approved)));<br><br>            }   <br> }</pre><p>I hope you found this helpful! Happy learning.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6e5bc2a487a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[D365FO: How to assign document attachments from one record to another]]></title>
            <link>https://medium.com/@mateen462/d365fo-how-to-assign-document-attachments-from-one-record-to-another-58656d289a44?source=rss-88738f0b5808------2</link>
            <guid isPermaLink="false">https://medium.com/p/58656d289a44</guid>
            <category><![CDATA[attachment]]></category>
            <category><![CDATA[d365-fo]]></category>
            <dc:creator><![CDATA[Mateen Ahmed]]></dc:creator>
            <pubDate>Tue, 07 Nov 2023 09:06:08 GMT</pubDate>
            <atom:updated>2023-11-07T09:06:08.751Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TDpsYkO-zfPoz7NjyP-bsw.jpeg" /></figure><p>Many times, there is a requirement to transfer the records from one table entry to another table entry. This can be achieved with a simple code. The trick is to figure out if the Company/Entity (DataAreaId) is the same or different.</p><p>In the recent client requirement, I had to transfer data from the Master Table to the Entity table i.e. Master table had entries from all entities.</p><p>If the company is the same you can use the following function:</p><pre>private void CopyAttachments(RecId masterRecord, RecId newRecord)<br>        {<br><br>            DocuRef MasterDocuRef;<br><br>            while select MasterDocuRef<br>                where MasterDocuRef.RefTableId == tableNum(BeneficiaryMaster)<br>                &amp;&amp;   MasterDocuRef.RefRecId == masterRecord<br>            {<br>                // MasterDocuRef is the Recid of record where you want to copy the record from<br>                // newRecord is the recid of the record where you want to paste the attachment<br>                // third argument is the tableId of the table where you want to copy the attachment<br>                DocuRef::createFromDocuRef(MasterDocuRef,newRecord , tableNum(Beneficiary));<br>                <br><br>            }<br>        }</pre><p>If the company or DataAreaId of the record is different, you can use the following code which has little change in the logic:</p><pre>private void CopyAttachments(RecId masterRecord, RecId newRecord, str companyId)<br>        {<br><br>            DocuRef MasterDocuRef;<br><br>            DocuRef ProjTableDocuRef;<br><br>            while select MasterDocuRef<br>                where MasterDocuRef.RefTableId == tableNum(BeneficiaryMaster)<br>                &amp;&amp;   MasterDocuRef.RefRecId == masterRecord<br>            {<br>                if(MasterDocuRef.RecId)<br>                {<br>                    ProjTableDocuRef.data(MasterDocuRef);<br>                    ProjTableDocuRef.RefTableId     = tableNum(Beneficiary);<br>                    ProjTableDocuRef.RefRecId       = newRecord;<br>                    // Sets the company according to the argument received<br>                    ProjTableDocuRef.RefCompanyId   = companyId;<br>                    ProjTableDocuRef.insert();<br>                }<br><br>            }<br>        }</pre><p>I hope this helps you out!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58656d289a44" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[D365F&O: How to apply a range to the data source to only show data assigned to the current user in…]]></title>
            <link>https://medium.com/@mateen462/d365f-o-how-to-apply-a-range-to-the-data-source-to-only-show-data-assigned-to-the-current-user-in-2a89ae69ce08?source=rss-88738f0b5808------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a89ae69ce08</guid>
            <category><![CDATA[workflow]]></category>
            <category><![CDATA[d365]]></category>
            <category><![CDATA[d365-fo]]></category>
            <dc:creator><![CDATA[Mateen Ahmed]]></dc:creator>
            <pubDate>Wed, 18 Oct 2023 06:54:16 GMT</pubDate>
            <atom:updated>2023-10-18T06:54:16.508Z</atom:updated>
            <content:encoded><![CDATA[<h3>D365F&amp;O: How to apply a range to the data source to only show data assigned to the current user in Workflow</h3><p>Many times, there is a requirement to create a form that only shows the data that has been assigned to the currently logged-in user. This can be rather a simple task and you can apply a range to the data source of the form in execute query method of the respective data source.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ei0DYittyGdnl9CzoVDGIQ.png" /></figure><p>Inside the execute query, write the following code:</p><pre>QueryBuildDataSource  queryBuildDataSource;<br><br>// Set the data source to your custom table (your_tableName) <br>queryBuildDataSource = this.query().dataSourceTable(tablenum(your_tableName));<br>queryBuildDataSource.clearRanges(); // Clear any existing query ranges<br>// Add a new data source for the WORKFLOWWORKITEMTABLE and apply filters<br>queryBuildDataSource = queryBuildDataSource.addDataSource(tableNum(WORKFLOWWORKITEMTABLE));<br>// Filter by RefTableId field, matching it with your custom table&#39;s ID<br>queryBuildDataSource.addRange(fieldnum(WORKFLOWWORKITEMTABLE,RefTableId)).value(int2Str(TableNum(your_tableName)));<br>// Filter by the Status field, selecting records with a status of &quot;Pending&quot;<br>queryBuildDataSource.addRange(fieldnum(WORKFLOWWORKITEMTABLE,Status)).value(enum2str(WorkflowStatus::Pending));<br>// Filter by UserId, selecting records for the current user<br>queryBuildDataSource.addRange(fieldnum(WORKFLOWWORKITEMTABLE,UserId)).value(curUserId());<br>// Set the join mode to InnerJoin to retrieve matching records<br>queryBuildDataSource.joinMode(JoinMode::InnerJoin);<br>// Disable relations for this data source<br>queryBuildDataSource.relations(false);<br>// Add a link between your custom table&#39;s RecId and the RefRecId in WORKFLOWWORKITEMTABLE<br>queryBuildDataSource.addLink(fieldNum(your_tableName, RecId),fieldNum(WORKFLOWWORKITEMTABLE, RefRecId));</pre><p>It will do the job for you! I hope that helps. Happy Learning!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a89ae69ce08" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Conversion of Date to Hijri Date: D365fo X++]]></title>
            <link>https://medium.com/@mateen462/conversion-of-date-to-hijri-date-d365fo-x-fded01dcd3fb?source=rss-88738f0b5808------2</link>
            <guid isPermaLink="false">https://medium.com/p/fded01dcd3fb</guid>
            <category><![CDATA[dynamics-365]]></category>
            <category><![CDATA[d365-fo]]></category>
            <dc:creator><![CDATA[Mateen Ahmed]]></dc:creator>
            <pubDate>Thu, 28 Sep 2023 17:20:03 GMT</pubDate>
            <atom:updated>2023-09-28T17:20:03.019Z</atom:updated>
            <content:encoded><![CDATA[<p>This article is going to be very short and concise!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*GI5ahI5hor510AIklMS66w.png" /></figure><p>Ever wondered how to convert the current data to the Hijri data? I will help you out! Here is the X++ code function to convert the current data to Islamic Calender data:</p><pre> private void setHijriDate()<br>    {<br>        TransDate           dateTime;<br>        CalendarConverter   CalendarConverter;<br>        int                 HijriDt;<br>        int                 HijriMonth;<br>        str                 Yr,finaldate;<br>        int                 findate;<br>        str                 Hijridat,HijriMnth,HijriYr;<br><br>        CalendarConverter   = new CalendarConverter(PreferredCalendar::Hijri);<br><br>        // Save the Day, Month, and Year.<br>        HijriDt             = CalendarConverter.dayofmth(this.CurrentDate);<br>        HijriMonth          = CalendarConverter.mthofyr(this.CurrentDate);<br>        Yr                  = CalendarConverter.yearStr(this.CurrentDate);<br><br>        Hijridat    = int2str(HijriDt);<br>        HijriMnth   = int2str(HijriMonth);<br><br>        // Sub string is taken as i want to return only two digits of year<br>        HijriYr     = subStr(Yr,3,5);<br>        finaldate   = HijriYr + &#39;/&#39; + HijriMnth + &#39;/&#39; + Hijridat;<br>    }</pre><p>Happy Learning!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fded01dcd3fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Upload Photos from Power Apps to Sharepoint using Power Automate]]></title>
            <link>https://medium.com/@mateen462/upload-photos-from-power-apps-to-sharepoint-using-power-automate-5aacae5d265d?source=rss-88738f0b5808------2</link>
            <guid isPermaLink="false">https://medium.com/p/5aacae5d265d</guid>
            <category><![CDATA[powerapps]]></category>
            <category><![CDATA[sharepoint-development]]></category>
            <category><![CDATA[power-automate]]></category>
            <dc:creator><![CDATA[Mateen Ahmed]]></dc:creator>
            <pubDate>Thu, 07 Sep 2023 07:51:48 GMT</pubDate>
            <atom:updated>2023-09-07T07:51:48.390Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi there, let’s explore how to upload photos from your Power Application to Sharepoint. You cannot directly upload photos to SharePoint, but you can take the help of Power Automate connectors. Let’s explore it further.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*Mbs99w9LbBPECwoDL-fdQg.png" /></figure><p>This article assumes that you have access to Power Apps, Power Automate, and Sharepoint.</p><p>Let us configure Power Apps first. In this functionality, we will upload a simple picture and then send it to the SharePoint document library.</p><p>Insert the Picture in the media section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/311/1*GJ1SFeqhuNvoQF5b0PS0RA.png" /></figure><p>Next, insert a button that will upload the image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/1*qLGb_KHqWZ1p6gU5XOjmow.png" /></figure><p>Set the text of the Button to <strong>Upload Image</strong>. Your frontend will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*TRNVMl4UUOrXPKwhPW0EQg.png" /></figure><p>In SharePoint, we need to create a Document Library. In your site, go to New, And then create a Document Library. Give it an appropriate name. I have given it <strong>PhotoUploadTut</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/230/1*riGCCRx14BH9RIjHgRLqcg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*-tPXohYV2GT84qK8wQCUvw.png" /></figure><p>Now that it is set up. Let us move to Power Automate.</p><p>Let’s configure the flow in Power Automate. Build an <strong>Instant Cloud Flow</strong> and select Power Apps as a trigger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/261/1*m5LzrrlZfuojNbXZzd3JjQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*vHgpCXK2_xHEqodkxrL6BA.png" /></figure><p>Choose a next step operation and choose Sharepoint trigger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*fS3v6jH2rkUw6pDdcZWeDA.png" /></figure><p>and then <strong>Create File</strong> action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*jRDnlDR74tfG_eqfNLtAmA.png" /></figure><p>This Action is used to insert a document inside the Document Library.</p><p>Give it the Site Address and the file path of the Document Library. In this tutorial, we will give a hardcoded value to the File name but you can also have a dynamic Value with <strong>Ask In PowerApps.</strong></p><p>In the File Content Section, Choose the <strong>Ask In PowerApps</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ckROl_5xOIrA7oUs3tgIyw.png" /></figure><p>This will generate the variable which will be sent from Power Apps. But we also have to add an expression. Delete the variable from the File Content Section. Now go to the Expression section next to the Dynamic Content, add the DataUriToBinary function, pass the variable of the PowerApps inside this function, and press Save. Here is the expression in my case:</p><pre>dataUriToBinary(triggerBody()[&#39;Createfile_FileContent&#39;])</pre><p>In the end, the action will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*7zuSL1X7wv88lCMyPamXeA.png" /></figure><p>Power Automate is all set and now we need to send values from Power Apps where things can get a bit tricky!</p><p>Note: Make sure to save your flow at this point.</p><p>In Power Apps, add the flow you have created. In my case, I will add the flow <strong>PhotoUploadTut</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*HM-wW_8vuaqUlNUyDhme0w.png" /></figure><p>The tree view of my application is as follows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*qrgEidl4yRN8TP01-hBaIA.png" /></figure><p>The elements&#39; names or numbers might be different for you, so posting this just for reference.</p><p>In the OnSelect Function of the button, we need to implement some logic.</p><p>The logic is as follows:</p><pre>Set(tutImage, JSON(UploadedImage3.Image,JSONFormat.IncludeBinaryData));<br>Set(tutTrim,Mid(tutImage,2,Len(tutImage)-2));<br><br>PhotoUploadTut.Run(tutTrim);</pre><p>What we are doing is basically converting the file path i.e. UploadedImage3.Image to Binary Data and saving it to variable tutImage.</p><p>Next, we need to remove the Inverted commas from the start and end. We save this to tutTrim.</p><p>The processing is done, we send the data to the Power Automate. Hope this is clear. If you have any questions, I will be happy to help.</p><p>Let’s test this out.</p><p>I uploaded the picture in Power Apps:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*gRVpx35jAFCZP3rJimCqBA.png" /></figure><p>Now Clicking on the Upload Picture will add this image to the Sharepoint Document Library:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O-Xw702ArC9tNfV_5AtOow.png" /></figure><p>If you click on the image name, it actually opens up!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*onk6lnbua49LvabQ6n7IIA.png" /></figure><p>This is me with my team by the way. Cute, hehe!</p><p>Hope this helps and that you understand how to upload images now! Cheers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5aacae5d265d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>