Relation between CompanyInfo and LogisticsElectronicAddress - axapta

I want to make a query to get the information of an actual company and put it in a report. I need to get the full name of company, address, phone number and fax.
I tried to get some information about my company from the table "CompanyInfo" but we don't have a field to get phone or fax. I tried a display method, but the method returned nothing!
I want to make a relation between "CompanyInfo" and "LogisticsElectronicAddress" (I can find phone or fax from LogisticsElectronicAddress.Locator where LogisticsElectronicAddress.Type == phone (or fax)).
Can someone please help me to make a display method or query to get what I want?

Don't make it harder:
Str phone = CompanyInfo::find().phone();
Str address = CompanyInfo::find().postalAddress().Address;
Str zip = CompanyInfo::find().postalAddress().ZipCode;
Will find the current phone number, address and zip code of the current company.
If phone is blank then the phone number is not current. Make sure the phone number is marked "Primary" and that it is valid (in a valid time range as indicated by the ValidFrom and ValidTo fields.
In AX 2012 from "Legal entities", "Contact information", choose "More options" and "Advanced" to see the date rages.
Same thing with the address info.

Related

Searching phone number in .NET Core

I'm working on a project where I have to add the functionality of searching for phone numbers using dot net core. on SignUp, we are storing phone numbers in SQL Server using the country code eg: "+923007418819".
So if the user searches the phone number with 03007418819 it's not matching the data stored in the database and returns null.
The main thing I want is that if the user enters the phone number 03007418819 like this, it searches with the last 10 digits.
How can it be done?
First you have to create a computed persistant column with the reversed phone number like this :
ALTER TABLE T_PHONE ADD _PHONE_NUMBER_REVERSE AS REVERSE(PHONE_NUMBER) PERSISTED;
Second you have to create an index for performances searches :
CREATE INDEX X_001 ON T_PHONE (_PHONE_NUMBER_REVERSE);
Last, you have to use a WHERE clause like this one :
WHERE _PHONE_NUMBER_REVERSE LIKE REVERSE('03007418819') + '%'
This is the most efficient way to do that !
You can use SUBSTRING :
SELECT SUBSTRING([your column name], 3, 10) AS phone,
FROM [your table name]
WHERE [your column name] = [search term];
Different approach:
the best way to solve this issue from its roots is to save all users' phone numbers in the database in a specific format e.g. 00[countrycode][rest]
Create a helper that will format any valid phone number the user enters to the format you want when signing up. All phone numbers will be then formatted before being saved in the database. (The database will be then formatted and clean)
When the user tries to sign in, the same helper will first be called and format the number the user entered, and then you can easily search in the database with no magic. With this tiny modification, you can win the database index as well.

Patch function doesn't send items to my sharepoint list ( Power Apps)

please, I have a problem with the Patch function, it shows me no error but it sends nothing to the sharepoint list, here are the columns I have:
Country, Project_Customer, Project_Category, Project_Type, are comboboxes of choice, project_site is a search column, project manager is a person type column, project description and project name are text lines and project amount is a number (currency type) , and project_status is a dropdown.
here is the patch function:
{Country: ComboBoxCOUNTRY.Selected;
Project_Customer: ComboBoxCustomer.Selected;
Project_site: ComboBoxSite.Selected;
Project_Category: ComboBoxCATEGORY.Selected;
Project_Type: ComboBoxPROJECTTYPE.Selected;
Project_Name: Text (TextInputProjectName);
Project_Amount: TextInputProjectAmount;
Project_status: DropdownSTATUS;
Project_manager: ComboBoxmanager;
'Project_Description': Text (TextInputDETAIL)})````
Different SharePoint fields have different requirements for patching.
For a Person field you have to send an object with Claims, Department, DisplayName, Email, Jobtitle and Picture fields, but only the Claims, displayname and email address seem to be required (you may want to experiment with which fields actually need a value, but all of them have to be present). Below is an example from one of my powerapps
AssignedTo: {'#odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:Concatenate("i:0#.f|membership|",Assignee.UserPrincipalName),
Department:"",
DisplayName:Assignee.DisplayName,
Email:Assignee.Mail,
JobTitle:"",
Picture:""
}
For SharePoint choice fields, you have to send an object with a value property
mychoicefield: {Value: "some value" }
For lookup fields, you have to send an ID and value, where ID is the ID from the lookup list item and Value is the Title
MyLookupField: { ID:1,Value:"Some title"}
Patch doesn't throw an error when you send the wrong information. YOu can capture and output your patch by setting a variable or checking for errors. I typically do both
Set(PatchResults,Patch(datasource,defaults(datasource),{
Title: "Hello"
};
If(Not(IsEmpty(Errors(datasource))),Notify(First(Errors(datasource)).Message,NotificationType.Error))
The above check if the datasource to which you patched has any errors and if there are, creates a message at the top with a red background.

Google App Maker Query Builder

Created a simple app to keep track of the company fax numbers. In my header I have a search box where I want user's to search either by First Name, Last Name or both First and Last Name. I added the below to Query Builder
firstName contains? :SearchText or
lastName contains? :SearchText
Searching by first name or last name works just fine. How can I search by both first and last name? Right now when I search by both I get no results. Thanks.
"User Picker" widget should be a good fit for your case.
If you want to keep custom employees model please consider the following options:
Add Name field ("FirstName LastName") so contains operator would give expected result
Switch datasource to Query Script and process search query
(https://developers.google.com/appmaker/models/datasources#query_script)

Remove text from one field and output the result into another field.

We currently have emails that go out to people when an Project has been assigned to them.
However we want to make it so that when the Info Path Form is changed, it only sends out an email to the people who have not been emailed before.
We have tried, Translate to remove the text.
So for example:
It will be:
Persons to be Emailed: Joe.Bloggs#email.co.uk
Persons Email List: Joe.Bloggs#email.co.uk
Persons Emailed - Joe.Bloggs#email.co.uk
Form is updated, and we add paul.bloggs#email.co.uk
Updated fields as below (how it should be):
Persons to be Emailed: Joe.Bloggs#email.co.uk
Persons Email List: Joe.Bloggs#email.co.uk | paul.bloggs#email.co.uk
Persons Emailed - Joe.Bloggs#email.co.uk
How do you remove the emails in Person Emailed from the Email List and then return the value in Persons to be emailed?
Try using concat() to append the new users email onto the email list. Ex:
concat(PersonsEmailListField, " | ", EmailToAddField)
You can concat as many things as you want, just keep adding parameters. You might also want to do some cleanup/integrity validation (check if there was data in the email to add field before appending, etc).
If I understood your problem correctly, you wanted to have the new email entry in the "Person to be Emailed".
Try this, create a rule in "Email List" field with no condition and with the following formula:
translate(substring-after(. , PersonsEmailed), " |","")
First part of the formula is substring-after (., PersonsEmailed) . In this formula, we are getting the new email entry after the PersonsEmailed value.
The second part is translating the result. The raw result that we will be getting from the first formula ha spaces and it includes the "|" character. That is why we are translating any spaces and the character to no space.
Now after sending the email to the new email entry, you can use concat() to add the new email entry and the Emailed values and enter it in the PersonsEmailed field.

SilverStripe - PhoneNumberField output

I am trying to use PhoneNumberField to get the phone number but it gives the output as an array. How can I get the exact input?
$mobilePhone = PhoneNumberField::create('MobileTelephone', 'Mobile Telephone *');
Assuming you are submitting your form to an action such as public function send($data, $form) {...} then you would retrieve the phone number with PhoneNumberField::joinPhoneNumber($data['MobileTelephone']).
According to the PhoneNumberField API description:
Field for displaying phone numbers. It separates the number, the area code and optionally the country code and extension.
Reading the PhoneNumberField code we can see the field is a grouping of fields for the phone number's Country, Area, Number and Extension. By default only the Number field is used, but it will still return the results as an array.

Resources